Repository navigation
Conversation
Add JaxRsRouteParser, which turns JAX-RS @path routes ({name: regex} with whitespace, nested braces and '/' inside the regex) into a RouteTemplate, treating regexes that accept '/' as catch-alls by a static scan. Add JaxRsRequestMatch, an immutable carrier of the decoded mount prefix and bound path parameters for the JAX-RS decorators. Tests cover the RFC-1125 vectors expressible in JAX-RS syntax.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 390297d7c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
A nested class can negate its members ([^[^/]] accepts '/'), so flattening it as a union misclassified a catch-all as a constrained param. Classes with a nested class or an intersection now count as accepting '/', like the other uncertain constructs of the scan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca2108ac3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Valid Unicode property aliases and character-class ranges are misclassified as required parameters. Empty catch-all bindings consequently render /files/{path} instead of /files, producing incorrect normalized-route tags.
🤖 Bits Code Review · Commit ca2108a
The scan now answers YES, NO or UNKNOWN: negating a class never flips an uncertain answer, \p{..} properties are slash-free only from an explicit whitelist, \Q..\E and \N{..} inside a class are uncertain, and a lone & is a literal. Any uncertain answer makes the param a catch-all, so presence still comes from the bound value. Also covers ']' as first class member and the (?x) flag.
There was a problem hiding this comment.
More details
The PR adds JAX-RS route parsing and request-match data for _dd.appsec.normalized_route, with framework integration deferred to the stacked PR. All three earlier defects—Unicode property aliases, quoted range endpoints, and lone ampersand ranges—are fixed, and the incremental review leaves no findings open.
🤖 Bits Code Review · Commit 0f123e8
What Does This Do
Adds the JAX-RS route tokenizer for the
_dd.appsec.normalized_routetag, on top of the shared core indatadog.trace.api.appsec.route(no core class changes). This is PR 1 of 2; the Jersey and RESTEasy integrations come in the stacked PR.JaxRsRouteParser(parse/cached, 256-entryDDCachelikeSpringRouteParser) turns the route built from the class and method@Pathinto aRouteTemplate:{name}and{ name : regex }(whitespace, nested braces and/inside the regex); the regex is never part of the tag.{id}.{format},user-{id},{a}-{b}-{c})./({path: .*}) is a catch-all (one parameter, optional when empty). This is decided by a static scan of the regex (.,\S/\W/\D,\x2F,\u002F, octal, negated and range classes,\p{..}/\P{..}), never withjava.util.regex.NOT_EXPRESSIBLE(no tag).JaxRsRequestMatch: immutable carrier of the decoded mount prefix and a copy of the bound path values captured by the framework, plus theSUBRESOURCEmarker for sub-resource locators.JaxRsRouteParserTest,JaxRsRouteParserRfcVectorsTest(RFC-1125 rows 1-14, 30-35 and 49 in JAX-RS syntax; the other rows use syntax JAX-RS does not have),JaxRsRouteParserCacheTest,JaxRsRequestMatchTest.Motivation
RFC-1125 (amends RFC-1103): normalized routes for API Security Testing. Follow-up of APPSEC-62077 (Spring MVC #13633, WebFlux #13635).
Additional Notes
%XXin@Pathas escapes. The core renderer re-encodes literals from their text, so the parser decodes each escape and lets the core encode it again:caf%c3%a9andcafégivecaf%C3%A9,%20stays. Escapes of unreserved characters come out decoded (%7Egives~): keeping them would need a core change.}inside a regex character class ({id: [}a]+}) closes the parameter early, so the route gets no tag (fails closed, tested).Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: APPSEC-72043
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.