Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ruleset Engine] Review examples for request body fields #19118

Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved below the example value.


```txt
any(http.request.body.form["username"][*] == "admin")
```

Example value:

`{username": ["admin"]}`
pedrosousa marked this conversation as resolved.
Show resolved Hide resolved

Example:

`any(http.request.body.form["username"][*] == "admin")`

## `http.request.body.form.names`

`http.request.body.form.names` <Type text='Array<String>' />
Expand All @@ -97,16 +96,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:

```txt
any(http.request.body.form.names[*] == "username")
```

Example value:

`["username"]`

Example:

`any(http.request.body.form.names[*] == "username")`

## `http.request.body.form.values`

`http.request.body.form.values` <Type text='Array<String>' />
Expand All @@ -123,16 +120,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:

```txt
any(http.request.body.form.values[*] == "admin")
```

Example value:

`["admin"]`

Example:

`any(http.request.body.form.values[*] == "admin")`

## `http.request.body.mime`

`http.request.body.mime` <Type text='String' />
Expand All @@ -141,9 +136,13 @@ The MIME type of the request detected from the request body.

Supports the most common MIME types of the following general categories: video, audio, image, application, text.

Example value:

`"image/jpeg"`

Example:

`image/jpeg`
`http.request.body.mime in {"image/bmp" "image/gif" "image/jpeg" "image/png" "image/tiff"}`

This field is available on all Cloudflare plans.

Expand All @@ -155,7 +154,11 @@ A Map (or associative array) representation of multipart names to multipart valu

Example value:

`{"username": ["alice_doe"], "picture": [<binary_content_of_file>]}`
`{"username": ["alice_doe"], "role": ["editor"], "picture": [<binary_content_of_file>]}`

Example:

`any(http.request.body.multipart["role"][*] == "admin")`

## `http.request.body.multipart.names`

Expand All @@ -181,6 +184,10 @@ Example value:

`["alice_doe", <binary_content_of_file>]`

Example:

`any(http.request.body.multipart.values[*] == "alice_doe")`

## `http.request.body.multipart.content_types`

`http.request.body.multipart.content_types` <Type text='Array<Array<String>>' />
Expand All @@ -203,7 +210,11 @@ List of `Content-Disposition` headers for each part in the multipart body.

Example value:

`[["form-data; name=\"username\"], ["form-data;name=\"picture\"]]`
`[["form-data; name=\"username\""], ["form-data; name=\"picture\""]]`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed example value (missing double quotes).


Example:

`any(http.request.body.multipart.content_dispositions[*][0] in {"form-data; name=\"username\"" "form-data; name=\"picture\""})`

## `http.request.body.multipart.content_transfer_encodings`

Expand All @@ -213,7 +224,11 @@ List of `Content-Transfer-Encoding` headers for each part in the multipart body.

Example value:

`[["quoted-printable"], ["quoted-printable"]]`
`[["quoted-printable"], ["base64"]]`

Example:

`any(http.request.body.multipart.content_transfer_encodings[*][0] == "binary")`

## `http.request.body.multipart.filenames`

Expand All @@ -224,3 +239,7 @@ List of filenames for each part in the multipart body.
Example value:

`[["file1.txt"], ["photo.jpg"]]`

Example:

`any(http.request.body.multipart.filenames[*][0] in {"token.txt" "password.txt"})`
Loading