feat(appsec): express v5 normalized route followup #11301
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 249 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11301"
general
weight: 0.35
IlyasShabi
What does this PR do?
Follow-up to #8857. It updates the Express 5
_dd.appsec.normalized_routetag to the amended normalized route rules RFC-1125 which amends RFC-1103:/users/user-{id},/files/{name}.json./photos/{id}.{format}instead of{id+format}.[A-Za-z0-9_], and a name that collides gets a_Nsuffix:/a/{user_id_2}/{user_id}./posts{/draft}gives/posts/draftor/posts), and an empty catch-all counts as absent.req.paramsinstead of being dropped.Presence is resolved with path-to-regexp's own
match(), trying each optional form of the route in Express's order with the serving Router'scaseSensitive/strictoptions. The router instrumentation publishes those options on a newdatadog:router:route:createchannel, and AppSec subscribes to it.Motivation
The first implementation followed RFC-1103. That RFC drops the tag when optional parts can't be resolved, and its output isn't valid OpenAPI: the
+combining and the dropped static text. RFC-1125 fixes both, so the tag describes the route that was actually served and can be exported as an OpenAPI path.Additional Notes
http.routeis unchanged.[APPSEC-62076]: https://datadoghq.atlassian.net/browse/APPSEC-62076?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ