-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Ruleset Engine] New fields reference #19214
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
Merged
pedrosousa
merged 48 commits into
production
from
pedro/PCX-14693-ruleset-engine-new-fields-reference-poc
Jan 17, 2025
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
cf1a4f7
[Ruleset Engine] Fields reference PoC
pedrosousa eef4f30
Add search (text, categories)
pedrosousa f8e4e45
Add geolocation field
pedrosousa dadadcf
Small changes to fields
pedrosousa 7e6eba9
Remove Keywords filter
pedrosousa 90e3791
Add more fields
pedrosousa 79e3a7c
Fix fields
pedrosousa 3149aaf
Add more fields
pedrosousa 8133070
Add JWT validation fields
pedrosousa decf46d
Add field requirements
pedrosousa ad9797e
Add request header fields
pedrosousa 3c455c7
Add request body fields
pedrosousa daa74ac
Disable conversion of relative links to absolute links
pedrosousa 7622de5
Add note about body fields
pedrosousa 47a35b2
Order fields and categories in field catalog
pedrosousa 4a68d2e
Don't use details in individual field pages
pedrosousa 234d0aa
Add response fields
pedrosousa 3d58109
Move test field to the end of the list
pedrosousa 8c0ff01
Update geolocation fields
pedrosousa 152571b
Update formatting
pedrosousa 5db1607
Move FieldBadges file
pedrosousa b449e9d
Show plan requirement in FieldCatalog
pedrosousa 37823e5
Small updates to field content
pedrosousa 7205cd4
Catalog: Add tooltip with name & data type
pedrosousa 177ff46
Adjust required plans
pedrosousa f9df7ea
Remove commented code
pedrosousa 4417c48
Remove unused property from fields schema
pedrosousa 5a9495d
Merge branch 'production' into pedro/PCX-14693-ruleset-engine-new-fie…
pedrosousa e66ebd1
Update CSS based on ModelCatalog changes
pedrosousa 06439b8
Fix field description
pedrosousa d779260
Stretch items vertically
pedrosousa 410a22c
Add "mTLS" category
pedrosousa 27493db
Add expression example for multipart.content_dispositions
pedrosousa e82ae12
Rename Example >> Example usage
pedrosousa c0c9bea
Quote string examples; add some example usages
pedrosousa b6d4d0e
Update field links (scripted)
pedrosousa 74782fb
Manual link updates (point to reference when appropriate)
pedrosousa 16c46b5
Move Magic Firewall fields page to MFW tile
pedrosousa 8b63feb
Remove old pages with fields
pedrosousa 8f9d7bb
Merge branch 'production' into pedro/PCX-14693-ruleset-engine-new-fie…
pedrosousa 449f7ec
Update a few more links
pedrosousa 05a91c2
Add new api_gateway fields
pedrosousa 8768d8e
Fix field description
pedrosousa 0827ac1
Ignore individual field pages in link checker (existing issue with dots)
pedrosousa 4d4c9fd
Remove link
pedrosousa 425fe58
Small text update
pedrosousa a8b9add
Merge branch 'production' into pedro/PCX-14693-ruleset-engine-new-fie…
pedrosousa b0b71f9
Fix nested anchor tags in Markdown
KianNH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,140 @@ | ||
| import { useState } from "react"; | ||
| import FieldBadges from "./fields/FieldBadges"; | ||
| import Markdown from "react-markdown"; | ||
|
|
||
| const FieldCatalog = ({ fields }) => { | ||
| const [filters, setFilters] = useState({ | ||
| search: "", | ||
| categories: [], | ||
| keywords: [], | ||
| }); | ||
| const mapped = fields.sort((f1, f2) => { | ||
| return f1.name < f2.name ? -1 : 1; | ||
| }); | ||
|
|
||
| const categories = [ | ||
| ...new Set( | ||
| fields | ||
| .map((field) => field.categories) | ||
| .flat() | ||
| .sort(), | ||
| ), | ||
| ]; | ||
|
|
||
| // apply filters to the fields list | ||
| const fieldList = mapped.filter((field) => { | ||
| if (filters.categories.length > 0) { | ||
| if (!field.categories?.some((c) => filters.categories.includes(c))) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| if (filters.search) { | ||
| // search keywords | ||
| let keywordFound = field.keywords?.some( | ||
| (kw) => kw.indexOf(filters.search) >= 0, | ||
| ); | ||
|
|
||
| if ( | ||
| !field.name.toLowerCase().includes(filters.search.toLowerCase()) && | ||
| !field.summary.toLowerCase().includes(filters.search.toLowerCase()) && | ||
| !keywordFound | ||
| ) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| }); | ||
|
|
||
| return ( | ||
| <div className="md:flex"> | ||
| <div className="mr-8 w-full md:w-1/4"> | ||
| <input | ||
| type="text" | ||
| className="mb-8 w-full rounded-md border-2 border-gray-200 bg-white px-2 py-2 dark:border-gray-700 dark:bg-gray-800" | ||
| placeholder="Search fields" | ||
| value={filters.search} | ||
| onChange={(e) => setFilters({ ...filters, search: e.target.value })} | ||
| /> | ||
|
|
||
| <div className="!mb-8 hidden md:block"> | ||
| <span className="text-sm font-bold uppercase text-gray-600 dark:text-gray-200"> | ||
| ▼ Categories | ||
| </span> | ||
|
|
||
| {categories.map((category) => ( | ||
| <label key={category} className="!my-2 block"> | ||
| <input | ||
| type="checkbox" | ||
| className="mr-2" | ||
| value={category} | ||
| onClick={(e) => { | ||
| if (e.target.checked) { | ||
| setFilters({ | ||
| ...filters, | ||
| categories: [...filters.categories, e.target.value], | ||
| }); | ||
| } else { | ||
| setFilters({ | ||
| ...filters, | ||
| categories: filters.categories.filter( | ||
| (f) => f !== e.target.value, | ||
| ), | ||
| }); | ||
| } | ||
| }} | ||
| />{" "} | ||
| {category} | ||
| </label> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="!mt-0 flex w-full flex-wrap items-stretch gap-[1%] self-start md:w-3/4"> | ||
| {fieldList.length === 0 && ( | ||
| <div className="flex w-full flex-col justify-center rounded-md border bg-gray-50 py-6 text-center align-middle dark:border-gray-500 dark:bg-gray-800"> | ||
| <span className="text-lg !font-bold">No fields found</span> | ||
| <p> | ||
| Try a different search term, or broaden your search by removing | ||
| filters. | ||
| </p> | ||
| </div> | ||
| )} | ||
| {fieldList.map((field) => { | ||
| return ( | ||
| <a | ||
| key={field.name} | ||
| className="mb-3 block w-full self-stretch rounded-md border border-solid border-gray-200 p-3 !text-inherit no-underline hover:bg-gray-50 dark:border-gray-700 dark:hover:bg-gray-800 lg:w-[48%]" | ||
| href={`/ruleset-engine/rules-language/fields/reference/${field.name}/`} | ||
| > | ||
| <div className="-mb-1 flex items-center"> | ||
| <span | ||
| className="font-semibold text-lg text-ellipsis overflow-hidden whitespace-nowrap" | ||
| title={`${field.name}: ${field.data_type}`} | ||
| > | ||
| {field.name} | ||
| </span> | ||
| </div> | ||
| <Markdown | ||
| className="!mt-2 line-clamp-2 text-sm leading-6" | ||
| disallowedElements={["a"]} | ||
| unwrapDisallowed={true} | ||
| > | ||
| {field.summary} | ||
| </Markdown> | ||
|
|
||
| {field.plan_info_label && ( | ||
| <div className="!mt-2 text-xs"> | ||
| <FieldBadges badges={[field.plan_info_label]} /> | ||
| </div> | ||
| )} | ||
| </a> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default FieldCatalog; |
This file contains hidden or 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,16 @@ | ||
| const FieldBadges = ({ badges }) => { | ||
| return ( | ||
| <ul className="list-none m-0 p-0 inline-flex items-center gap-2 text-xs"> | ||
| {badges.map((badge) => ( | ||
| <li | ||
| key={badge} | ||
| className="bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded-md block !mt-0" | ||
| > | ||
| {badge} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ); | ||
| }; | ||
|
|
||
| export default FieldBadges; |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -31,4 +31,4 @@ As an example, to send the `x-send-jwt-claim-user` request header to the origin, | |
| 4. Enter a rule name and a filter expression, if applicable. | ||
| 5. Choose **Set dynamic**. | ||
| 6. Set the header name to `x-send-jwt-claim-user`. | ||
| 7. Set the value to `lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIGURATION_ID>"][0], "claim_name")`, where `<TOKEN_CONFIGURATION_ID>` is your token configuration ID found in JWT Validation and `claim_name` is the [JWT claim](/ruleset-engine/rules-language/fields/dynamic-fields/#json-web-tokens-validation-claims) you want to add to the header. | ||
| 7. Set the value to `lookup_json_string(http.request.jwt.claims["<TOKEN_CONFIGURATION_ID>"][0], "claim_name")`, where `<TOKEN_CONFIGURATION_ID>` is your token configuration ID found in JWT Validation and `claim_name` is the JWT claim you want to add to the header. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed link because we're not yet documenting the |
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR moves this page back to the Magic Firewall tile. There's a separate (inverse) redirect handling this change.