Skip to content

Commit 47597f0

Browse files
authored
[WAF] Update example expressions for leaked credentials detection (#18068)
1 parent 7792a82 commit 47597f0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/content/docs/waf/detections/leaked-credentials/get-started.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,18 @@ To check for leaked credentials in a way that is not covered by the default conf
9090

9191
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/), and select your account and domain.
9292
2. Go to **Security** > **Settings**.
93-
3. Under **Incoming traffic detections**, select **Leaked credentials** and then select the three dots to add a custom detection.
94-
4. In **Username location**, enter an expression for obtaining the username in the HTTP request. For example:
93+
3. Under **Incoming traffic detections**, select **Leaked credentials** and then select **Add custom username and password location**.
94+
4. In **Username location** and **Password location** (optional), enter expressions for obtaining the username and the password from the HTTP request. Refer to the following example expressions:
9595

96-
```txt
97-
lookup_json_string(http.request.body.raw, "user")
98-
```
96+
| Request type | Username location / Password location |
97+
| ---------------- | --------------------------------------------------------------------------------------------------------------- |
98+
| JSON body | `lookup_json_string(http.request.body.raw, "user")`<br/>`lookup_json_string(http.request.body.raw, "secret")` |
99+
| URL-encoded form | `url_decode(http.request.body.form["user"][0])`<br/>`url_decode(http.request.body.form["secret"][0])` |
100+
| Multipart form | `url_decode(http.request.body.multipart["user"][0])`<br/>`url_decode(http.request.body.multipart["secret"][0])` |
99101

100-
5. In **Password location**, enter an expression for obtaining the password in the HTTP request. For example:
102+
Refer to the [`lookup_json_string()`](/ruleset-engine/rules-language/functions/#lookup_json_string) and [`url_decode()`](/ruleset-engine/rules-language/functions/#url_decode) documentation for more information on these functions.
101103

102-
```txt
103-
lookup_json_string(http.request.body.raw, "secret")
104-
```
105-
106-
6. Select **Save**.
104+
5. Select **Save**.
107105

108106
</TabItem> <TabItem label="API">
109107

@@ -126,6 +124,8 @@ This pair of lookup expressions (for username and password) will scan incoming H
126124
{"user": "<username>", "secret": "<password>"}
127125
```
128126

127+
Refer to the [`lookup_json_string()`](/ruleset-engine/rules-language/functions/#lookup_json_string) documentation for more information on this function.
128+
129129
</TabItem> </Tabs>
130130

131131
You only need to provide an expression for the username in custom detection locations.

0 commit comments

Comments
 (0)