Add server.request.body.filenames AppSec address for Jersey and RESTEasy#11171
Conversation
5ca9b2f to
86c4da5
Compare
|
@codex review |
1123a3b to
510fca6
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 10 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.06 s) : 0, 1059922
Total [baseline] (8.841 s) : 0, 8841443
Agent [candidate] (1.072 s) : 0, 1071751
Total [candidate] (8.847 s) : 0, 8846805
section iast
Agent [baseline] (1.24 s) : 0, 1240402
Total [baseline] (9.516 s) : 0, 9515654
Agent [candidate] (1.24 s) : 0, 1239950
Total [candidate] (9.526 s) : 0, 9526424
gantt
title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.22 ms) : 0, 1220
crashtracking [candidate] (1.236 ms) : 0, 1236
BytebuddyAgent [baseline] (633.32 ms) : 0, 633320
BytebuddyAgent [candidate] (641.666 ms) : 0, 641666
AgentMeter [baseline] (29.382 ms) : 0, 29382
AgentMeter [candidate] (29.773 ms) : 0, 29773
GlobalTracer [baseline] (248.017 ms) : 0, 248017
GlobalTracer [candidate] (249.675 ms) : 0, 249675
AppSec [baseline] (32.764 ms) : 0, 32764
AppSec [candidate] (32.884 ms) : 0, 32884
Debugger [baseline] (59.7 ms) : 0, 59700
Debugger [candidate] (60.047 ms) : 0, 60047
Remote Config [baseline] (600.664 µs) : 0, 601
Remote Config [candidate] (603.329 µs) : 0, 603
Telemetry [baseline] (9.163 ms) : 0, 9163
Telemetry [candidate] (8.398 ms) : 0, 8398
Flare Poller [baseline] (9.799 ms) : 0, 9799
Flare Poller [candidate] (11.285 ms) : 0, 11285
section iast
crashtracking [baseline] (1.233 ms) : 0, 1233
crashtracking [candidate] (1.222 ms) : 0, 1222
BytebuddyAgent [baseline] (821.187 ms) : 0, 821187
BytebuddyAgent [candidate] (821.391 ms) : 0, 821391
AgentMeter [baseline] (11.279 ms) : 0, 11279
AgentMeter [candidate] (11.244 ms) : 0, 11244
GlobalTracer [baseline] (237.947 ms) : 0, 237947
GlobalTracer [candidate] (236.299 ms) : 0, 236299
IAST [baseline] (26.423 ms) : 0, 26423
IAST [candidate] (27.451 ms) : 0, 27451
AppSec [baseline] (32.302 ms) : 0, 32302
AppSec [candidate] (30.405 ms) : 0, 30405
Debugger [baseline] (62.278 ms) : 0, 62278
Debugger [candidate] (64.062 ms) : 0, 64062
Remote Config [baseline] (521.716 µs) : 0, 522
Remote Config [candidate] (531.257 µs) : 0, 531
Telemetry [baseline] (7.943 ms) : 0, 7943
Telemetry [candidate] (7.953 ms) : 0, 7953
Flare Poller [baseline] (3.304 ms) : 0, 3304
Flare Poller [candidate] (3.359 ms) : 0, 3359
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.074 s) : 0, 1074191
Total [baseline] (11.086 s) : 0, 11086225
Agent [candidate] (1.063 s) : 0, 1062629
Total [candidate] (10.939 s) : 0, 10938770
section appsec
Agent [baseline] (1.271 s) : 0, 1270825
Total [baseline] (11.097 s) : 0, 11097487
Agent [candidate] (1.274 s) : 0, 1274220
Total [candidate] (11.085 s) : 0, 11084790
section iast
Agent [baseline] (1.242 s) : 0, 1242288
Total [baseline] (11.317 s) : 0, 11317414
Agent [candidate] (1.24 s) : 0, 1239812
Total [candidate] (11.284 s) : 0, 11283980
section profiling
Agent [baseline] (1.186 s) : 0, 1186333
Total [baseline] (10.995 s) : 0, 10994620
Agent [candidate] (1.194 s) : 0, 1194214
Total [candidate] (10.983 s) : 0, 10983464
gantt
title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.242 ms) : 0, 1242
crashtracking [candidate] (1.218 ms) : 0, 1218
BytebuddyAgent [baseline] (640.447 ms) : 0, 640447
BytebuddyAgent [candidate] (634.269 ms) : 0, 634269
AgentMeter [baseline] (29.827 ms) : 0, 29827
AgentMeter [candidate] (29.388 ms) : 0, 29388
GlobalTracer [baseline] (251.758 ms) : 0, 251758
GlobalTracer [candidate] (248.781 ms) : 0, 248781
AppSec [baseline] (33.377 ms) : 0, 33377
AppSec [candidate] (32.747 ms) : 0, 32747
Debugger [baseline] (62.428 ms) : 0, 62428
Debugger [candidate] (60.725 ms) : 0, 60725
Remote Config [baseline] (607.632 µs) : 0, 608
Remote Config [candidate] (613.607 µs) : 0, 614
Telemetry [baseline] (10.007 ms) : 0, 10007
Telemetry [candidate] (9.842 ms) : 0, 9842
Flare Poller [baseline] (8.283 ms) : 0, 8283
Flare Poller [candidate] (9.111 ms) : 0, 9111
section appsec
crashtracking [baseline] (1.243 ms) : 0, 1243
crashtracking [candidate] (1.222 ms) : 0, 1222
BytebuddyAgent [baseline] (679.176 ms) : 0, 679176
BytebuddyAgent [candidate] (680.972 ms) : 0, 680972
AgentMeter [baseline] (12.246 ms) : 0, 12246
AgentMeter [candidate] (12.366 ms) : 0, 12366
GlobalTracer [baseline] (249.948 ms) : 0, 249948
GlobalTracer [candidate] (251.54 ms) : 0, 251540
IAST [baseline] (24.922 ms) : 0, 24922
IAST [candidate] (24.986 ms) : 0, 24986
AppSec [baseline] (185.659 ms) : 0, 185659
AppSec [candidate] (185.77 ms) : 0, 185770
Debugger [baseline] (65.174 ms) : 0, 65174
Debugger [candidate] (64.859 ms) : 0, 64859
Remote Config [baseline] (559.987 µs) : 0, 560
Remote Config [candidate] (570.323 µs) : 0, 570
Telemetry [baseline] (7.874 ms) : 0, 7874
Telemetry [candidate] (7.925 ms) : 0, 7925
Flare Poller [baseline] (6.775 ms) : 0, 6775
Flare Poller [candidate] (6.207 ms) : 0, 6207
section iast
crashtracking [baseline] (1.223 ms) : 0, 1223
crashtracking [candidate] (1.236 ms) : 0, 1236
BytebuddyAgent [baseline] (821.146 ms) : 0, 821146
BytebuddyAgent [candidate] (820.271 ms) : 0, 820271
AgentMeter [baseline] (11.241 ms) : 0, 11241
AgentMeter [candidate] (11.259 ms) : 0, 11259
GlobalTracer [baseline] (238.701 ms) : 0, 238701
GlobalTracer [candidate] (236.752 ms) : 0, 236752
IAST [baseline] (27.387 ms) : 0, 27387
IAST [candidate] (27.271 ms) : 0, 27271
AppSec [baseline] (30.652 ms) : 0, 30652
AppSec [candidate] (31.216 ms) : 0, 31216
Debugger [baseline] (63.948 ms) : 0, 63948
Debugger [candidate] (63.854 ms) : 0, 63854
Remote Config [baseline] (527.209 µs) : 0, 527
Remote Config [candidate] (517.587 µs) : 0, 518
Telemetry [baseline] (7.921 ms) : 0, 7921
Telemetry [candidate] (8.018 ms) : 0, 8018
Flare Poller [baseline] (3.461 ms) : 0, 3461
Flare Poller [candidate] (3.368 ms) : 0, 3368
section profiling
crashtracking [baseline] (1.187 ms) : 0, 1187
crashtracking [candidate] (1.196 ms) : 0, 1196
BytebuddyAgent [baseline] (691.714 ms) : 0, 691714
BytebuddyAgent [candidate] (696.897 ms) : 0, 696897
AgentMeter [baseline] (8.9 ms) : 0, 8900
AgentMeter [candidate] (8.983 ms) : 0, 8983
GlobalTracer [baseline] (207.606 ms) : 0, 207606
GlobalTracer [candidate] (209.369 ms) : 0, 209369
AppSec [baseline] (32.688 ms) : 0, 32688
AppSec [candidate] (32.973 ms) : 0, 32973
Debugger [baseline] (66.149 ms) : 0, 66149
Debugger [candidate] (66.155 ms) : 0, 66155
Remote Config [baseline] (587.552 µs) : 0, 588
Remote Config [candidate] (575.093 µs) : 0, 575
Telemetry [baseline] (8.102 ms) : 0, 8102
Telemetry [candidate] (8.122 ms) : 0, 8122
Flare Poller [baseline] (3.567 ms) : 0, 3567
Flare Poller [candidate] (3.532 ms) : 0, 3532
ProfilingAgent [baseline] (94.289 ms) : 0, 94289
ProfilingAgent [candidate] (94.497 ms) : 0, 94497
Profiling [baseline] (94.838 ms) : 0, 94838
Profiling [candidate] (95.056 ms) : 0, 95056
LoadParameters
See matching parameters
SummaryFound 3 performance improvements and 0 performance regressions! Performance is the same for 16 metrics, 17 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section baseline
no_agent (17.378 ms) : 17204, 17553
. : milestone, 17378,
appsec (18.809 ms) : 18620, 18999
. : milestone, 18809,
code_origins (18.783 ms) : 18596, 18970
. : milestone, 18783,
iast (17.829 ms) : 17652, 18005
. : milestone, 17829,
profiling (18.265 ms) : 18088, 18443
. : milestone, 18265,
tracing (18.993 ms) : 18806, 19180
. : milestone, 18993,
section candidate
no_agent (18.112 ms) : 17929, 18294
. : milestone, 18112,
appsec (18.6 ms) : 18410, 18790
. : milestone, 18600,
code_origins (17.861 ms) : 17684, 18038
. : milestone, 17861,
iast (17.788 ms) : 17613, 17963
. : milestone, 17788,
profiling (18.4 ms) : 18218, 18583
. : milestone, 18400,
tracing (17.622 ms) : 17451, 17794
. : milestone, 17622,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section baseline
no_agent (1.285 ms) : 1272, 1298
. : milestone, 1285,
iast (3.327 ms) : 3277, 3377
. : milestone, 3327,
iast_FULL (5.896 ms) : 5838, 5954
. : milestone, 5896,
iast_GLOBAL (3.708 ms) : 3649, 3766
. : milestone, 3708,
profiling (2.199 ms) : 2178, 2221
. : milestone, 2199,
tracing (1.894 ms) : 1879, 1910
. : milestone, 1894,
section candidate
no_agent (1.243 ms) : 1231, 1255
. : milestone, 1243,
iast (3.331 ms) : 3281, 3382
. : milestone, 3331,
iast_FULL (5.902 ms) : 5842, 5962
. : milestone, 5902,
iast_GLOBAL (3.544 ms) : 3485, 3602
. : milestone, 3544,
profiling (2.307 ms) : 2287, 2328
. : milestone, 2307,
tracing (1.904 ms) : 1888, 1919
. : milestone, 1904,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section baseline
no_agent (15.602 s) : 15602000, 15602000
. : milestone, 15602000,
appsec (14.948 s) : 14948000, 14948000
. : milestone, 14948000,
iast (18.579 s) : 18579000, 18579000
. : milestone, 18579000,
iast_GLOBAL (17.97 s) : 17970000, 17970000
. : milestone, 17970000,
profiling (15.096 s) : 15096000, 15096000
. : milestone, 15096000,
tracing (14.769 s) : 14769000, 14769000
. : milestone, 14769000,
section candidate
no_agent (15.491 s) : 15491000, 15491000
. : milestone, 15491000,
appsec (14.684 s) : 14684000, 14684000
. : milestone, 14684000,
iast (18.446 s) : 18446000, 18446000
. : milestone, 18446000,
iast_GLOBAL (17.745 s) : 17745000, 17745000
. : milestone, 17745000,
profiling (15.019 s) : 15019000, 15019000
. : milestone, 15019000,
tracing (14.822 s) : 14822000, 14822000
. : milestone, 14822000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~93f7907f46, baseline=1.62.0-SNAPSHOT~5609365061
dateFormat X
axisFormat %s
section baseline
no_agent (1.489 ms) : 1477, 1500
. : milestone, 1489,
appsec (2.541 ms) : 2485, 2596
. : milestone, 2541,
iast (2.287 ms) : 2216, 2357
. : milestone, 2287,
iast_GLOBAL (2.33 ms) : 2259, 2401
. : milestone, 2330,
profiling (2.117 ms) : 2061, 2173
. : milestone, 2117,
tracing (2.081 ms) : 2027, 2134
. : milestone, 2081,
section candidate
no_agent (1.49 ms) : 1478, 1502
. : milestone, 1490,
appsec (2.56 ms) : 2504, 2615
. : milestone, 2560,
iast (2.285 ms) : 2214, 2356
. : milestone, 2285,
iast_GLOBAL (2.339 ms) : 2268, 2410
. : milestone, 2339,
profiling (2.129 ms) : 2073, 2186
. : milestone, 2129,
tracing (2.082 ms) : 2028, 2136
. : milestone, 2082,
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 510fca6013
ℹ️ 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".
635a97f to
21a5777
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21a57776c3
ℹ️ 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".
21a5777 to
dc887ea
Compare
78d29ab to
6ff7c4d
Compare
b58f1e6 to
d1da0e3
Compare
d1da0e3 to
4f53294
Compare
|
@codex review |
|
Please have a look to Reflection in MultipartHelper (RESTEasy) I think is a good approach to avoid more modules and code duplication, love to hear your thoughts 😃 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f53294c1c
ℹ️ 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".
…isposition Tabs after ';' and optional SP/HT around '=' are valid per MIME and are delivered by RESTEasy as-is; the previous parser only skipped literal spaces, so those variants bypassed server.request.body.filenames detection.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
- Correct BlockingException message in jersey-appsec-2.0 and jersey-appsec-3.0: was "MultiPartReaderClientSide/readFrom", now "MultiPartReaderServerSide/readMultiPart" - Add combined body-map + filenames test to jersey-appsec-2.0 and jersey-appsec-3.0 MultiPartHelperTest to cover the case where both outputs are populated simultaneously - Add null input test to resteasy MultipartHelperTest for filenameFromContentDisposition
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
|
Thanks for your comments @ValentinZakharov, I'm going to fix the issues in a new PR that I need to do for file content supports and reuse the instrumentation |
What Does This Do
Adds
server.request.body.filenamesAppSec gateway event support for Jersey 2.x, Jersey 3.x, and RESTEasy.Jersey 2.x and 3.x
MultiPartHelperclass (one per namespace module) with:collectBodyPart(FormDataBodyPart, Map, List<String>)— populates the body map and/or filenames list for a single body part, replacing the inline logic in the advicefilenameFromBodyPart(FormDataBodyPart)— extracts the filename fromFormDataContentDispositionMultiPartReaderServerSideInstrumentationnow subscribes toEVENTS.requestFilesFilenames(), collects filenames via the helper, and fires the blocking flow if neededhelperClassNames()declared to injectMultiPartHelperinto the app classloaderRESTEasy
MultipartHelperclass with:collectFilenames(MultipartFormDataInput)— iterates parts, readsContent-Dispositionheaders via reflection, and delegates tofilenameFromContentDispositionfilenameFromContentDisposition(String)— quote-aware parser that handles semicolons inside quoted filenames (e.g.filename="a;b.php")MultipartFormDataReaderInstrumentationnow subscribes toEVENTS.requestFilesFilenames(), callsMultipartHelper.collectFilenames(), and fires the blocking flow if neededhelperClassNames()declared to injectMultipartHelperTests
MultiPartHelperTest(Jersey 2 and 3) andMultipartHelperTest(RESTEasy)testBodyFilenames() { true }opted in forGrizzlyTest,Jersey2JettyTest, andJersey3JettyTestMotivation
Implements the
server.request.body.filenamesAppSec address for Jersey and RESTEasy as part of APPSEC-61873.Additional Notes
Reflection in
MultipartHelper(RESTEasy)InputPart.getHeaders()returnsjavax.ws.rs.core.MultivaluedMapin RESTEasy 3.x andjakarta.ws.rs.core.MultivaluedMapin RESTEasy 6.x. A direct bytecode reference to either type fails muzzle for the other version.To avoid this,
MultipartHelperresolves the method once at class-load time via reflection and caches it in astatic finalfield:The static initializer runs once in the app classloader (where the library is already present), so the reflection cost is zero per request and there is no bytecode reference to the problematic return type — muzzle passes across all RESTEasy versions.
This approach was preferred over the alternatives — duplicating the module by version, bounding the muzzle range, or restructuring the call site — which have historically caused cascading changes across multiple modules.
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-61873
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.