Add server.request.body.filenames AppSec address for Jersey and RESTEasy#11171
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 1 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 9 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.064 s) : 0, 1063621
Total [baseline] (8.851 s) : 0, 8851020
Agent [candidate] (1.058 s) : 0, 1058438
Total [candidate] (8.82 s) : 0, 8819912
section iast
Agent [baseline] (1.239 s) : 0, 1239294
Total [baseline] (9.535 s) : 0, 9535364
Agent [candidate] (1.229 s) : 0, 1229256
Total [candidate] (9.557 s) : 0, 9556836
gantt
title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.251 ms) : 0, 1251
crashtracking [candidate] (1.217 ms) : 0, 1217
BytebuddyAgent [baseline] (638.876 ms) : 0, 638876
BytebuddyAgent [candidate] (633.475 ms) : 0, 633475
AgentMeter [baseline] (29.856 ms) : 0, 29856
AgentMeter [candidate] (29.487 ms) : 0, 29487
GlobalTracer [baseline] (250.508 ms) : 0, 250508
GlobalTracer [candidate] (249.949 ms) : 0, 249949
AppSec [baseline] (32.443 ms) : 0, 32443
AppSec [candidate] (32.625 ms) : 0, 32625
Debugger [baseline] (59.065 ms) : 0, 59065
Debugger [candidate] (59.433 ms) : 0, 59433
Remote Config [baseline] (591.333 µs) : 0, 591
Remote Config [candidate] (624.295 µs) : 0, 624
Telemetry [baseline] (8.015 ms) : 0, 8015
Telemetry [candidate] (8.108 ms) : 0, 8108
Flare Poller [baseline] (6.648 ms) : 0, 6648
Flare Poller [candidate] (7.382 ms) : 0, 7382
section iast
crashtracking [baseline] (1.245 ms) : 0, 1245
crashtracking [candidate] (1.238 ms) : 0, 1238
BytebuddyAgent [baseline] (812.778 ms) : 0, 812778
BytebuddyAgent [candidate] (808.322 ms) : 0, 808322
AgentMeter [baseline] (11.529 ms) : 0, 11529
AgentMeter [candidate] (11.412 ms) : 0, 11412
GlobalTracer [baseline] (240.981 ms) : 0, 240981
GlobalTracer [candidate] (238.717 ms) : 0, 238717
AppSec [baseline] (31.985 ms) : 0, 31985
AppSec [candidate] (26.546 ms) : 0, 26546
Debugger [baseline] (64.668 ms) : 0, 64668
Debugger [candidate] (63.012 ms) : 0, 63012
Remote Config [baseline] (542.242 µs) : 0, 542
Remote Config [candidate] (519.946 µs) : 0, 520
Telemetry [baseline] (7.849 ms) : 0, 7849
Telemetry [candidate] (7.683 ms) : 0, 7683
Flare Poller [baseline] (3.433 ms) : 0, 3433
Flare Poller [candidate] (3.381 ms) : 0, 3381
IAST [baseline] (27.938 ms) : 0, 27938
IAST [candidate] (31.583 ms) : 0, 31583
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.06 s) : 0, 1059508
Total [baseline] (11.009 s) : 0, 11009266
Agent [candidate] (1.065 s) : 0, 1065132
Total [candidate] (11.136 s) : 0, 11136023
section appsec
Agent [baseline] (1.263 s) : 0, 1262651
Total [baseline] (10.934 s) : 0, 10933791
Agent [candidate] (1.262 s) : 0, 1261521
Total [candidate] (10.971 s) : 0, 10971279
section iast
Agent [baseline] (1.24 s) : 0, 1239598
Total [baseline] (11.294 s) : 0, 11293888
Agent [candidate] (1.23 s) : 0, 1230097
Total [candidate] (11.271 s) : 0, 11270817
section profiling
Agent [baseline] (1.186 s) : 0, 1186211
Total [baseline] (11.073 s) : 0, 11072660
Agent [candidate] (1.187 s) : 0, 1187486
Total [candidate] (11.173 s) : 0, 11173422
gantt
title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.231 ms) : 0, 1231
crashtracking [candidate] (1.226 ms) : 0, 1226
BytebuddyAgent [baseline] (634.236 ms) : 0, 634236
BytebuddyAgent [candidate] (637.107 ms) : 0, 637107
AgentMeter [baseline] (29.616 ms) : 0, 29616
AgentMeter [candidate] (29.792 ms) : 0, 29792
GlobalTracer [baseline] (249.249 ms) : 0, 249249
GlobalTracer [candidate] (250.61 ms) : 0, 250610
AppSec [baseline] (32.431 ms) : 0, 32431
AppSec [candidate] (32.647 ms) : 0, 32647
Debugger [baseline] (59.829 ms) : 0, 59829
Debugger [candidate] (60.318 ms) : 0, 60318
Remote Config [baseline] (591.801 µs) : 0, 592
Remote Config [candidate] (601.19 µs) : 0, 601
Telemetry [baseline] (8.073 ms) : 0, 8073
Telemetry [candidate] (8.086 ms) : 0, 8086
Flare Poller [baseline] (8.195 ms) : 0, 8195
Flare Poller [candidate] (8.398 ms) : 0, 8398
section appsec
crashtracking [baseline] (1.231 ms) : 0, 1231
crashtracking [candidate] (1.216 ms) : 0, 1216
BytebuddyAgent [baseline] (675.658 ms) : 0, 675658
BytebuddyAgent [candidate] (674.292 ms) : 0, 674292
AgentMeter [baseline] (12.192 ms) : 0, 12192
AgentMeter [candidate] (12.126 ms) : 0, 12126
GlobalTracer [baseline] (249.099 ms) : 0, 249099
GlobalTracer [candidate] (248.757 ms) : 0, 248757
AppSec [baseline] (187.097 ms) : 0, 187097
AppSec [candidate] (185.704 ms) : 0, 185704
Debugger [baseline] (64.793 ms) : 0, 64793
Debugger [candidate] (66.624 ms) : 0, 66624
Remote Config [baseline] (570.407 µs) : 0, 570
Remote Config [candidate] (579.438 µs) : 0, 579
Telemetry [baseline] (7.931 ms) : 0, 7931
Telemetry [candidate] (7.961 ms) : 0, 7961
Flare Poller [baseline] (3.458 ms) : 0, 3458
Flare Poller [candidate] (3.494 ms) : 0, 3494
IAST [baseline] (24.297 ms) : 0, 24297
IAST [candidate] (24.402 ms) : 0, 24402
section iast
crashtracking [baseline] (1.234 ms) : 0, 1234
crashtracking [candidate] (1.207 ms) : 0, 1207
BytebuddyAgent [baseline] (815.043 ms) : 0, 815043
BytebuddyAgent [candidate] (808.238 ms) : 0, 808238
AgentMeter [baseline] (11.442 ms) : 0, 11442
AgentMeter [candidate] (11.431 ms) : 0, 11431
GlobalTracer [baseline] (239.988 ms) : 0, 239988
GlobalTracer [candidate] (238.373 ms) : 0, 238373
AppSec [baseline] (28.629 ms) : 0, 28629
AppSec [candidate] (27.434 ms) : 0, 27434
Debugger [baseline] (64.314 ms) : 0, 64314
Debugger [candidate] (65.715 ms) : 0, 65715
Remote Config [baseline] (529.546 µs) : 0, 530
Remote Config [candidate] (525.195 µs) : 0, 525
Telemetry [baseline] (7.842 ms) : 0, 7842
Telemetry [candidate] (7.772 ms) : 0, 7772
Flare Poller [baseline] (3.456 ms) : 0, 3456
Flare Poller [candidate] (3.411 ms) : 0, 3411
IAST [baseline] (30.878 ms) : 0, 30878
IAST [candidate] (29.997 ms) : 0, 29997
section profiling
ProfilingAgent [baseline] (93.943 ms) : 0, 93943
ProfilingAgent [candidate] (94.572 ms) : 0, 94572
crashtracking [baseline] (1.189 ms) : 0, 1189
crashtracking [candidate] (1.175 ms) : 0, 1175
BytebuddyAgent [baseline] (692.802 ms) : 0, 692802
BytebuddyAgent [candidate] (693.129 ms) : 0, 693129
AgentMeter [baseline] (8.949 ms) : 0, 8949
AgentMeter [candidate] (8.971 ms) : 0, 8971
GlobalTracer [baseline] (207.501 ms) : 0, 207501
GlobalTracer [candidate] (207.851 ms) : 0, 207851
AppSec [baseline] (32.548 ms) : 0, 32548
AppSec [candidate] (32.654 ms) : 0, 32654
Debugger [baseline] (65.859 ms) : 0, 65859
Debugger [candidate] (65.815 ms) : 0, 65815
Remote Config [baseline] (585.984 µs) : 0, 586
Remote Config [candidate] (584.277 µs) : 0, 584
Telemetry [baseline] (7.929 ms) : 0, 7929
Telemetry [candidate] (7.912 ms) : 0, 7912
Flare Poller [baseline] (3.531 ms) : 0, 3531
Flare Poller [candidate] (3.523 ms) : 0, 3523
Profiling [baseline] (94.518 ms) : 0, 94518
Profiling [candidate] (95.147 ms) : 0, 95147
LoadParameters
See matching parameters
SummaryFound 4 performance improvements and 1 performance regressions! Performance is the same for 14 metrics, 17 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section baseline
no_agent (1.284 ms) : 1271, 1297
. : milestone, 1284,
iast (3.229 ms) : 3190, 3268
. : milestone, 3229,
iast_FULL (5.913 ms) : 5854, 5972
. : milestone, 5913,
iast_GLOBAL (3.687 ms) : 3621, 3754
. : milestone, 3687,
profiling (2.147 ms) : 2128, 2166
. : milestone, 2147,
tracing (1.886 ms) : 1869, 1903
. : milestone, 1886,
section candidate
no_agent (1.279 ms) : 1266, 1291
. : milestone, 1279,
iast (3.374 ms) : 3326, 3423
. : milestone, 3374,
iast_FULL (6.004 ms) : 5943, 6066
. : milestone, 6004,
iast_GLOBAL (3.659 ms) : 3606, 3712
. : milestone, 3659,
profiling (2.219 ms) : 2199, 2240
. : milestone, 2219,
tracing (1.913 ms) : 1896, 1929
. : milestone, 1913,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section baseline
no_agent (19.224 ms) : 19027, 19422
. : milestone, 19224,
appsec (18.625 ms) : 18438, 18813
. : milestone, 18625,
code_origins (17.823 ms) : 17648, 17998
. : milestone, 17823,
iast (19.85 ms) : 19653, 20048
. : milestone, 19850,
profiling (18.522 ms) : 18335, 18709
. : milestone, 18522,
tracing (19.01 ms) : 18820, 19201
. : milestone, 19010,
section candidate
no_agent (18.581 ms) : 18386, 18776
. : milestone, 18581,
appsec (19.055 ms) : 18863, 19246
. : milestone, 19055,
code_origins (17.869 ms) : 17694, 18043
. : milestone, 17869,
iast (17.657 ms) : 17484, 17830
. : milestone, 17657,
profiling (18.809 ms) : 18613, 19005
. : milestone, 18809,
tracing (17.887 ms) : 17712, 18062
. : milestone, 17887,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section baseline
no_agent (1.488 ms) : 1476, 1499
. : milestone, 1488,
appsec (2.571 ms) : 2515, 2627
. : milestone, 2571,
iast (2.294 ms) : 2223, 2364
. : milestone, 2294,
iast_GLOBAL (2.335 ms) : 2264, 2407
. : milestone, 2335,
profiling (2.122 ms) : 2065, 2178
. : milestone, 2122,
tracing (2.097 ms) : 2043, 2151
. : milestone, 2097,
section candidate
no_agent (1.487 ms) : 1476, 1499
. : milestone, 1487,
appsec (3.778 ms) : 3559, 3996
. : milestone, 3778,
iast (2.304 ms) : 2233, 2375
. : milestone, 2304,
iast_GLOBAL (2.349 ms) : 2277, 2420
. : milestone, 2349,
profiling (2.117 ms) : 2061, 2173
. : milestone, 2117,
tracing (2.089 ms) : 2034, 2143
. : milestone, 2089,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~a46b9fa02f, baseline=1.62.0-SNAPSHOT~8569434beb
dateFormat X
axisFormat %s
section baseline
no_agent (15.602 s) : 15602000, 15602000
. : milestone, 15602000,
appsec (15.19 s) : 15190000, 15190000
. : milestone, 15190000,
iast (18.575 s) : 18575000, 18575000
. : milestone, 18575000,
iast_GLOBAL (17.982 s) : 17982000, 17982000
. : milestone, 17982000,
profiling (15.66 s) : 15660000, 15660000
. : milestone, 15660000,
tracing (14.842 s) : 14842000, 14842000
. : milestone, 14842000,
section candidate
no_agent (15.266 s) : 15266000, 15266000
. : milestone, 15266000,
appsec (14.883 s) : 14883000, 14883000
. : milestone, 14883000,
iast (18.457 s) : 18457000, 18457000
. : milestone, 18457000,
iast_GLOBAL (18.129 s) : 18129000, 18129000
. : milestone, 18129000,
profiling (14.75 s) : 14750000, 14750000
. : milestone, 14750000,
tracing (15.132 s) : 15132000, 15132000
. : milestone, 15132000,
|
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". |
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.