Add session tracking support to vert.x 3/4#7953
Add session tracking support to vert.x 3/4#7953manuel-alvarez-alvarez wants to merge 2 commits intomasterfrom
Conversation
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
b2cab51 to
6fce896
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 53 metrics, 10 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.104 s) : 0, 1103590
Total [baseline] (8.776 s) : 0, 8776128
Agent [candidate] (1.087 s) : 0, 1087077
Total [candidate] (8.631 s) : 0, 8630804
section iast
Agent [baseline] (1.215 s) : 0, 1215017
Total [baseline] (9.165 s) : 0, 9165473
Agent [candidate] (1.215 s) : 0, 1215196
Total [candidate] (9.168 s) : 0, 9168360
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.216 s) : 0, 1215578
Total [baseline] (9.16 s) : 0, 9160046
Agent [candidate] (1.224 s) : 0, 1224287
Total [candidate] (9.191 s) : 0, 9190699
section iast_TELEMETRY_OFF
Agent [baseline] (1.212 s) : 0, 1211866
Total [baseline] (9.157 s) : 0, 9157018
Agent [candidate] (1.213 s) : 0, 1212674
Total [candidate] (9.148 s) : 0, 9148079
gantt
title insecure-bank - break down per module: candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (701.053 ms) : 0, 701053
BytebuddyAgent [candidate] (691.646 ms) : 0, 691646
GlobalTracer [baseline] (321.689 ms) : 0, 321689
GlobalTracer [candidate] (316.546 ms) : 0, 316546
AppSec [baseline] (55.539 ms) : 0, 55539
AppSec [candidate] (54.548 ms) : 0, 54548
Remote Config [baseline] (701.603 µs) : 0, 702
Remote Config [candidate] (680.937 µs) : 0, 681
Telemetry [baseline] (10.768 ms) : 0, 10768
Telemetry [candidate] (9.98 ms) : 0, 9980
section iast
BytebuddyAgent [baseline] (808.519 ms) : 0, 808519
BytebuddyAgent [candidate] (808.912 ms) : 0, 808912
GlobalTracer [baseline] (306.305 ms) : 0, 306305
GlobalTracer [candidate] (306.065 ms) : 0, 306065
AppSec [baseline] (56.271 ms) : 0, 56271
AppSec [candidate] (57.82 ms) : 0, 57820
IAST [baseline] (22.26 ms) : 0, 22260
IAST [candidate] (20.697 ms) : 0, 20697
Remote Config [baseline] (599.567 µs) : 0, 600
Remote Config [candidate] (597.458 µs) : 0, 597
Telemetry [baseline] (7.402 ms) : 0, 7402
Telemetry [candidate] (7.441 ms) : 0, 7441
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (809.098 ms) : 0, 809098
BytebuddyAgent [candidate] (815.389 ms) : 0, 815389
GlobalTracer [baseline] (306.301 ms) : 0, 306301
GlobalTracer [candidate] (308.051 ms) : 0, 308051
AppSec [baseline] (57.71 ms) : 0, 57710
AppSec [candidate] (56.437 ms) : 0, 56437
IAST [baseline] (20.664 ms) : 0, 20664
IAST [candidate] (22.5 ms) : 0, 22500
Remote Config [baseline] (606.867 µs) : 0, 607
Remote Config [candidate] (620.664 µs) : 0, 621
Telemetry [baseline] (7.487 ms) : 0, 7487
Telemetry [candidate] (7.524 ms) : 0, 7524
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (806.466 ms) : 0, 806466
BytebuddyAgent [candidate] (806.526 ms) : 0, 806526
GlobalTracer [baseline] (305.555 ms) : 0, 305555
GlobalTracer [candidate] (306.08 ms) : 0, 306080
AppSec [baseline] (57.928 ms) : 0, 57928
AppSec [candidate] (57.287 ms) : 0, 57287
IAST [baseline] (20.296 ms) : 0, 20296
IAST [candidate] (21.168 ms) : 0, 21168
Remote Config [baseline] (618.699 µs) : 0, 619
Remote Config [candidate] (613.79 µs) : 0, 614
Telemetry [baseline] (7.311 ms) : 0, 7311
Telemetry [candidate] (7.304 ms) : 0, 7304
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.094 s) : 0, 1094058
Total [baseline] (10.412 s) : 0, 10411776
Agent [candidate] (1.086 s) : 0, 1086305
Total [candidate] (10.421 s) : 0, 10420507
section appsec
Agent [baseline] (1.222 s) : 0, 1221706
Total [baseline] (10.701 s) : 0, 10701487
Agent [candidate] (1.227 s) : 0, 1227197
Total [candidate] (10.682 s) : 0, 10681909
section iast
Agent [baseline] (1.223 s) : 0, 1223176
Total [baseline] (10.951 s) : 0, 10950813
Agent [candidate] (1.218 s) : 0, 1217585
Total [candidate] (10.915 s) : 0, 10915132
section profiling
Agent [baseline] (1.322 s) : 0, 1322452
Total [baseline] (10.776 s) : 0, 10775931
Agent [candidate] (1.325 s) : 0, 1324783
Total [candidate] (10.793 s) : 0, 10792760
gantt
title petclinic - break down per module: candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (695.731 ms) : 0, 695731
BytebuddyAgent [candidate] (690.824 ms) : 0, 690824
GlobalTracer [baseline] (317.935 ms) : 0, 317935
GlobalTracer [candidate] (316.005 ms) : 0, 316005
AppSec [baseline] (54.53 ms) : 0, 54530
AppSec [candidate] (54.394 ms) : 0, 54394
Remote Config [baseline] (692.789 µs) : 0, 693
Remote Config [candidate] (699.883 µs) : 0, 700
Telemetry [baseline] (11.395 ms) : 0, 11395
Telemetry [candidate] (10.682 ms) : 0, 10682
section appsec
BytebuddyAgent [baseline] (708.548 ms) : 0, 708548
BytebuddyAgent [candidate] (713.171 ms) : 0, 713171
GlobalTracer [baseline] (313.794 ms) : 0, 313794
GlobalTracer [candidate] (314.641 ms) : 0, 314641
AppSec [baseline] (166.319 ms) : 0, 166319
AppSec [candidate] (165.559 ms) : 0, 165559
IAST [baseline] (21.237 ms) : 0, 21237
IAST [candidate] (21.088 ms) : 0, 21088
Remote Config [baseline] (634.937 µs) : 0, 635
Remote Config [candidate] (637.624 µs) : 0, 638
Telemetry [baseline] (8.138 ms) : 0, 8138
Telemetry [candidate] (8.865 ms) : 0, 8865
section iast
BytebuddyAgent [baseline] (814.088 ms) : 0, 814088
BytebuddyAgent [candidate] (810.335 ms) : 0, 810335
GlobalTracer [baseline] (307.911 ms) : 0, 307911
GlobalTracer [candidate] (306.57 ms) : 0, 306570
AppSec [baseline] (58.412 ms) : 0, 58412
AppSec [candidate] (57.294 ms) : 0, 57294
IAST [baseline] (20.843 ms) : 0, 20843
IAST [candidate] (21.648 ms) : 0, 21648
Remote Config [baseline] (612.032 µs) : 0, 612
Remote Config [candidate] (601.182 µs) : 0, 601
Telemetry [baseline] (7.551 ms) : 0, 7551
Telemetry [candidate] (7.448 ms) : 0, 7448
section profiling
BytebuddyAgent [baseline] (690.438 ms) : 0, 690438
BytebuddyAgent [candidate] (690.745 ms) : 0, 690745
GlobalTracer [baseline] (436.697 ms) : 0, 436697
GlobalTracer [candidate] (438.031 ms) : 0, 438031
AppSec [baseline] (53.946 ms) : 0, 53946
AppSec [candidate] (54.145 ms) : 0, 54145
Remote Config [baseline] (671.834 µs) : 0, 672
Remote Config [candidate] (659.258 µs) : 0, 659
Telemetry [baseline] (7.83 ms) : 0, 7830
Telemetry [candidate] (7.904 ms) : 0, 7904
ProfilingAgent [baseline] (93.655 ms) : 0, 93655
ProfilingAgent [candidate] (93.959 ms) : 0, 93959
Profiling [baseline] (93.679 ms) : 0, 93679
Profiling [candidate] (93.982 ms) : 0, 93982
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 17 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section baseline
no_agent (1.363 ms) : 1343, 1383
. : milestone, 1363,
appsec (1.724 ms) : 1698, 1749
. : milestone, 1724,
appsec_no_iast (1.744 ms) : 1720, 1769
. : milestone, 1744,
iast (1.484 ms) : 1461, 1507
. : milestone, 1484,
profiling (1.521 ms) : 1496, 1545
. : milestone, 1521,
tracing (1.465 ms) : 1440, 1490
. : milestone, 1465,
section candidate
no_agent (1.355 ms) : 1336, 1375
. : milestone, 1355,
appsec (1.745 ms) : 1720, 1770
. : milestone, 1745,
appsec_no_iast (1.733 ms) : 1707, 1759
. : milestone, 1733,
iast (1.486 ms) : 1464, 1509
. : milestone, 1486,
profiling (1.567 ms) : 1543, 1592
. : milestone, 1567,
tracing (1.475 ms) : 1449, 1500
. : milestone, 1475,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section baseline
no_agent (380.124 µs) : 358, 402
. : milestone, 380,
iast (481.632 µs) : 460, 503
. : milestone, 482,
iast_FULL (645.982 µs) : 625, 667
. : milestone, 646,
iast_GLOBAL (509.075 µs) : 488, 530
. : milestone, 509,
iast_HARDCODED_SECRET_DISABLED (487.204 µs) : 465, 509
. : milestone, 487,
iast_INACTIVE (446.429 µs) : 425, 468
. : milestone, 446,
iast_TELEMETRY_OFF (475.868 µs) : 455, 497
. : milestone, 476,
tracing (446.102 µs) : 424, 468
. : milestone, 446,
section candidate
no_agent (371.03 µs) : 351, 391
. : milestone, 371,
iast (485.754 µs) : 464, 507
. : milestone, 486,
iast_FULL (642.313 µs) : 621, 664
. : milestone, 642,
iast_GLOBAL (512.201 µs) : 490, 534
. : milestone, 512,
iast_HARDCODED_SECRET_DISABLED (485.251 µs) : 464, 507
. : milestone, 485,
iast_INACTIVE (443.631 µs) : 422, 465
. : milestone, 444,
iast_TELEMETRY_OFF (475.916 µs) : 455, 497
. : milestone, 476,
tracing (443.663 µs) : 423, 465
. : milestone, 444,
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 tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section baseline
no_agent (1.464 ms) : 1452, 1475
. : milestone, 1464,
appsec (2.329 ms) : 2288, 2370
. : milestone, 2329,
iast (2.08 ms) : 2028, 2133
. : milestone, 2080,
iast_GLOBAL (2.116 ms) : 2063, 2168
. : milestone, 2116,
profiling (1.95 ms) : 1908, 1991
. : milestone, 1950,
tracing (1.928 ms) : 1888, 1968
. : milestone, 1928,
section candidate
no_agent (1.469 ms) : 1457, 1480
. : milestone, 1469,
appsec (2.318 ms) : 2277, 2359
. : milestone, 2318,
iast (2.069 ms) : 2017, 2121
. : milestone, 2069,
iast_GLOBAL (2.119 ms) : 2066, 2171
. : milestone, 2119,
profiling (1.967 ms) : 1924, 2010
. : milestone, 1967,
tracing (1.905 ms) : 1866, 1945
. : milestone, 1905,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~68af1e048c, baseline=1.43.0-SNAPSHOT~79ca6e471f
dateFormat X
axisFormat %s
section baseline
no_agent (14.891 s) : 14891000, 14891000
. : milestone, 14891000,
appsec (14.853 s) : 14853000, 14853000
. : milestone, 14853000,
iast (19.21 s) : 19210000, 19210000
. : milestone, 19210000,
iast_GLOBAL (18.064 s) : 18064000, 18064000
. : milestone, 18064000,
profiling (14.927 s) : 14927000, 14927000
. : milestone, 14927000,
tracing (14.897 s) : 14897000, 14897000
. : milestone, 14897000,
section candidate
no_agent (15.25 s) : 15250000, 15250000
. : milestone, 15250000,
appsec (14.865 s) : 14865000, 14865000
. : milestone, 14865000,
iast (18.846 s) : 18846000, 18846000
. : milestone, 18846000,
iast_GLOBAL (17.617 s) : 17617000, 17617000
. : milestone, 17617000,
profiling (15.15 s) : 15150000, 15150000
. : milestone, 15150000,
tracing (15.172 s) : 15172000, 15172000
. : milestone, 15172000,
|
| final CallbackProvider cbp = AgentTracer.get().getCallbackProvider(RequestContextSlot.APPSEC); | ||
| BiFunction<RequestContext, String, Flow<Void>> callback = | ||
| cbp.getCallback(EVENTS.requestSession()); | ||
| if (callback == null) { | ||
| return; | ||
| } | ||
|
|
||
| Flow<Void> flow = callback.apply(reqCtx, session.id()); | ||
| Flow.Action action = flow.getAction(); | ||
| if (action instanceof Flow.Action.RequestBlockingAction) { | ||
| BlockResponseFunction blockResponseFunction = reqCtx.getBlockResponseFunction(); | ||
| if (blockResponseFunction == null) { | ||
| return; | ||
| } | ||
| Flow.Action.RequestBlockingAction rba = (Flow.Action.RequestBlockingAction) action; | ||
| blockResponseFunction.tryCommitBlockingResponse( | ||
| reqCtx.getTraceSegment(), | ||
| rba.getStatusCode(), | ||
| rba.getBlockingContentType(), | ||
| rba.getExtraHeaders()); | ||
| if (throwable == null) { | ||
| throwable = new BlockingException("Blocked request (for sessionId)"); | ||
| } |
There was a problem hiding this comment.
Not related with this PR but I have the feeling that we are repeating this pice of code every time we need to block something 😅
6fce896 to
038ec19
Compare
| rba.getBlockingContentType(), | ||
| rba.getExtraHeaders()); | ||
| if (throwable == null) { | ||
| throwable = new BlockingException("Blocked request (for sessionId)"); |
There was a problem hiding this comment.
should you need to change the throwable in this case or just not apply the advice at all?
There was a problem hiding this comment.
Sorry for the late response, I've closed this PR since we already merged the code in a newer PR.
For this particular case, if there is already an exception being thrown we don't want to hide it behind a BlockingException (it would effectively modify the intended behavior). But this is something that we must discuss internally because it might be a problem from a security standpoint.
038ec19 to
68af1e0
Compare
|
Duplicate of #8167 |
What Does This Do
Includes a new advice for the
RoutingContext#setSessionmethod to notify the WAF about the requested session id.Motivation
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any usefull labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: APPSEC-55855