-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WAF] Use JWT claims in custom rules (and rate limiting rules) (#17629)
- Loading branch information
1 parent
c08469f
commit 8c2e3ed
Showing
2 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...ntent/docs/waf/custom-rules/use-cases/check-jwt-claim-to-protect-admin-user.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
pcx_content_type: configuration | ||
title: Issue challenge for admin user in JWT claim based on attack score | ||
head: | ||
- tag: title | ||
content: Issue challenge for admin user in JWT claim based on attack score | ||
--- | ||
|
||
:::note | ||
To use claims inside a JSON Web Token (JWT), you must first set up a [token validation configuration](/api-shield/security/jwt-validation/configure/) in API Shield. | ||
::: | ||
|
||
This example configures additional protection for requests with a JSON Web Token (JWT) with a user claim of `admin`, based on the request's [attack score](/waf/detections/attack-score/). | ||
|
||
Create a custom rule that issues a Managed Challenge if the user claim in a JWT is `admin` and the attack score is below 40. | ||
|
||
- **Expression**: `(lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIGURATION_ID>"][0], "user") eq "admin" and cf.waf.score < 40)` | ||
- **Action**: _Managed Challenge_ | ||
|
||
In this example, `<TOKEN_CONFIGURATION_ID>` is your [token configuration ID](/api-shield/security/jwt-validation/configure/) found in JWT Validation and `user` is the JWT claim. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters