Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle WellKnown classes as primitives in EL #6263

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

jpbempel
Copy link
Member

@jpbempel jpbempel commented Nov 22, 2023

What Does This Do

WellKnown classes (like UUID) need to be treated as string primitives to be use in Expression Language and conditions
Add a list of string primitives

Motivation

coherency with serialization behavior

Additional Notes

Jira ticket: DEBUG-1689

WellKnown classes (like UUID) need to be treated as string primitives
to be use in Expression Language and conditions
Add a list of string primitives
@jpbempel jpbempel requested a review from a team as a code owner November 22, 2023 13:19
@jpbempel jpbempel requested review from shatzi and removed request for a team November 22, 2023 13:19
@pr-commenter
Copy link

pr-commenter bot commented Nov 22, 2023

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master jpbempel/well-known-class-el
git_commit_date 1700654362 1700659665
git_commit_sha cde4b1a a0060ff
release_version 1.25.0-SNAPSHOT~cde4b1a75b 1.25.0-SNAPSHOT~a0060ff2ec
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1700661658 1700661658
ci_job_id 375086296 375086296
ci_pipeline_id 23717186 23717186
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
module Agent Agent
parent None None
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 8 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.032 s) : 0, 1031514
Total [baseline] (8.676 s) : 0, 8675841
Agent [candidate] (1.038 s) : 0, 1037925
Total [candidate] (8.725 s) : 0, 8724687
section iast
Agent [baseline] (1.165 s) : 0, 1165313
Total [baseline] (9.328 s) : 0, 9328128
Agent [candidate] (1.153 s) : 0, 1153270
Total [candidate] (9.236 s) : 0, 9236129
section iast_TELEMETRY_OFF
Agent [baseline] (1.141 s) : 0, 1140619
Total [baseline] (9.235 s) : 0, 9235010
Agent [candidate] (1.144 s) : 0, 1143715
Total [candidate] (9.287 s) : 0, 9286940
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.032 s -
Agent iast 1.165 s 133.799 ms (13.0%)
Agent iast_TELEMETRY_OFF 1.141 s 109.105 ms (10.6%)
Total tracing 8.676 s -
Total iast 9.328 s 652.287 ms (7.5%)
Total iast_TELEMETRY_OFF 9.235 s 559.169 ms (6.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.038 s -
Agent iast 1.153 s 115.345 ms (11.1%)
Agent iast_TELEMETRY_OFF 1.144 s 105.79 ms (10.2%)
Total tracing 8.725 s -
Total iast 9.236 s 511.442 ms (5.9%)
Total iast_TELEMETRY_OFF 9.287 s 562.253 ms (6.4%)
gantt
    title insecure-bank - break down per module: candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (643.229 ms) : 0, 643229
BytebuddyAgent [candidate] (647.755 ms) : 0, 647755
GlobalTracer [baseline] (297.302 ms) : 0, 297302
GlobalTracer [candidate] (299.567 ms) : 0, 299567
AppSec [baseline] (48.84 ms) : 0, 48840
AppSec [candidate] (48.263 ms) : 0, 48263
Remote Config [baseline] (673.076 µs) : 0, 673
Remote Config [candidate] (680.134 µs) : 0, 680
Telemetry [baseline] (7.23 ms) : 0, 7230
Telemetry [candidate] (7.305 ms) : 0, 7305
section iast
BytebuddyAgent [baseline] (774.423 ms) : 0, 774423
BytebuddyAgent [candidate] (765.539 ms) : 0, 765539
GlobalTracer [baseline] (281.859 ms) : 0, 281859
GlobalTracer [candidate] (278.991 ms) : 0, 278991
AppSec [baseline] (48.598 ms) : 0, 48598
AppSec [candidate] (48.207 ms) : 0, 48207
IAST [baseline] (16.461 ms) : 0, 16461
IAST [candidate] (16.272 ms) : 0, 16272
Remote Config [baseline] (582.334 µs) : 0, 582
Remote Config [candidate] (571.236 µs) : 0, 571
Telemetry [baseline] (8.729 ms) : 0, 8729
Telemetry [candidate] (9.427 ms) : 0, 9427
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (756.27 ms) : 0, 756270
BytebuddyAgent [candidate] (759.087 ms) : 0, 759087
GlobalTracer [baseline] (278.61 ms) : 0, 278610
GlobalTracer [candidate] (278.493 ms) : 0, 278493
AppSec [baseline] (46.607 ms) : 0, 46607
AppSec [candidate] (47.004 ms) : 0, 47004
IAST [baseline] (16.488 ms) : 0, 16488
IAST [candidate] (17.199 ms) : 0, 17199
Remote Config [baseline] (565.961 µs) : 0, 566
Remote Config [candidate] (565.396 µs) : 0, 565
Telemetry [baseline] (7.789 ms) : 0, 7789
Telemetry [candidate] (7.114 ms) : 0, 7114
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.03 s) : 0, 1029808
Total [baseline] (9.324 s) : 0, 9323805
Agent [candidate] (1.048 s) : 0, 1047960
Total [candidate] (9.374 s) : 0, 9373565
section appsec
Agent [baseline] (1.124 s) : 0, 1123827
Total [baseline] (9.458 s) : 0, 9457915
Agent [candidate] (1.121 s) : 0, 1121042
Total [candidate] (9.421 s) : 0, 9421212
section iast
Agent [baseline] (1.158 s) : 0, 1158116
Total [baseline] (9.574 s) : 0, 9574026
Agent [candidate] (1.163 s) : 0, 1162742
Total [candidate] (9.591 s) : 0, 9590958
section profiling
Agent [baseline] (1.222 s) : 0, 1221729
Total [baseline] (9.633 s) : 0, 9633065
Agent [candidate] (1.223 s) : 0, 1222661
Total [candidate] (9.612 s) : 0, 9612093
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.03 s -
Agent appsec 1.124 s 94.019 ms (9.1%)
Agent iast 1.158 s 128.308 ms (12.5%)
Agent profiling 1.222 s 191.92 ms (18.6%)
Total tracing 9.324 s -
Total appsec 9.458 s 134.109 ms (1.4%)
Total iast 9.574 s 250.221 ms (2.7%)
Total profiling 9.633 s 309.26 ms (3.3%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.048 s -
Agent appsec 1.121 s 73.081 ms (7.0%)
Agent iast 1.163 s 114.781 ms (11.0%)
Agent profiling 1.223 s 174.701 ms (16.7%)
Total tracing 9.374 s -
Total appsec 9.421 s 47.646 ms (0.5%)
Total iast 9.591 s 217.393 ms (2.3%)
Total profiling 9.612 s 238.528 ms (2.5%)
gantt
    title petclinic - break down per module: candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (641.885 ms) : 0, 641885
BytebuddyAgent [candidate] (653.895 ms) : 0, 653895
GlobalTracer [baseline] (297.406 ms) : 0, 297406
GlobalTracer [candidate] (302.463 ms) : 0, 302463
AppSec [baseline] (48.542 ms) : 0, 48542
AppSec [candidate] (48.932 ms) : 0, 48932
Remote Config [baseline] (672.394 µs) : 0, 672
Remote Config [candidate] (693.089 µs) : 0, 693
Telemetry [baseline] (7.255 ms) : 0, 7255
Telemetry [candidate] (7.299 ms) : 0, 7299
section appsec
BytebuddyAgent [baseline] (644.933 ms) : 0, 644933
BytebuddyAgent [candidate] (644.275 ms) : 0, 644275
GlobalTracer [baseline] (300.031 ms) : 0, 300031
GlobalTracer [candidate] (298.412 ms) : 0, 298412
AppSec [baseline] (137.216 ms) : 0, 137216
AppSec [candidate] (136.66 ms) : 0, 136660
Remote Config [baseline] (655.001 µs) : 0, 655
Remote Config [candidate] (651.816 µs) : 0, 652
Telemetry [baseline] (6.817 ms) : 0, 6817
Telemetry [candidate] (6.808 ms) : 0, 6808
section iast
BytebuddyAgent [baseline] (769.229 ms) : 0, 769229
BytebuddyAgent [candidate] (772.034 ms) : 0, 772034
GlobalTracer [baseline] (279.835 ms) : 0, 279835
GlobalTracer [candidate] (280.581 ms) : 0, 280581
AppSec [baseline] (52.102 ms) : 0, 52102
AppSec [candidate] (51.513 ms) : 0, 51513
IAST [baseline] (14.068 ms) : 0, 14068
IAST [candidate] (14.043 ms) : 0, 14043
Remote Config [baseline] (575.856 µs) : 0, 576
Remote Config [candidate] (571.586 µs) : 0, 572
Telemetry [baseline] (7.892 ms) : 0, 7892
Telemetry [candidate] (9.342 ms) : 0, 9342
section profiling
BytebuddyAgent [baseline] (654.512 ms) : 0, 654512
BytebuddyAgent [candidate] (655.262 ms) : 0, 655262
GlobalTracer [baseline] (368.507 ms) : 0, 368507
GlobalTracer [candidate] (367.871 ms) : 0, 367871
AppSec [baseline] (48.539 ms) : 0, 48539
AppSec [candidate] (48.763 ms) : 0, 48763
Remote Config [baseline] (694.908 µs) : 0, 695
Remote Config [candidate] (696.992 µs) : 0, 697
Telemetry [baseline] (7.392 ms) : 0, 7392
Telemetry [candidate] (7.419 ms) : 0, 7419
ProfilingAgent [baseline] (88.071 ms) : 0, 88071
ProfilingAgent [candidate] (88.579 ms) : 0, 88579
Profiling [baseline] (88.095 ms) : 0, 88095
Profiling [candidate] (88.603 ms) : 0, 88603
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2023-11-22T13:40:06 2023-11-22T13:56:43
git_branch master jpbempel/well-known-class-el
git_commit_date 1700654362 1700659665
git_commit_sha cde4b1a a0060ff
release_version 1.25.0-SNAPSHOT~cde4b1a75b 1.25.0-SNAPSHOT~a0060ff2ec
start_time 2023-11-22T13:39:53 2023-11-22T13:56:30
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1700661658 1700661658
ci_job_id 375086296 375086296
ci_pipeline_id 23717186 23717186
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 13 unstable metrics.

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b
    dateFormat X
    axisFormat %s
section baseline
no_agent (370.418 µs) : 351, 390
.   : milestone, 370,
iast (473.156 µs) : 453, 494
.   : milestone, 473,
iast_FULL (537.466 µs) : 517, 558
.   : milestone, 537,
iast_INACTIVE (459.409 µs) : 439, 480
.   : milestone, 459,
iast_TELEMETRY_OFF (469.603 µs) : 449, 490
.   : milestone, 470,
tracing (444.394 µs) : 424, 465
.   : milestone, 444,
section candidate
no_agent (372.856 µs) : 351, 395
.   : milestone, 373,
iast (475.366 µs) : 455, 496
.   : milestone, 475,
iast_FULL (538.548 µs) : 518, 559
.   : milestone, 539,
iast_INACTIVE (454.781 µs) : 434, 475
.   : milestone, 455,
iast_TELEMETRY_OFF (469.595 µs) : 449, 490
.   : milestone, 470,
tracing (448.695 µs) : 428, 469
.   : milestone, 449,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 370.418 µs [350.595 µs, 390.241 µs] -
iast 473.156 µs [452.646 µs, 493.666 µs] 102.738 µs (27.7%)
iast_FULL 537.466 µs [516.878 µs, 558.055 µs] 167.048 µs (45.1%)
iast_INACTIVE 459.409 µs [438.761 µs, 480.056 µs] 88.99 µs (24.0%)
iast_TELEMETRY_OFF 469.603 µs [448.934 µs, 490.273 µs] 99.185 µs (26.8%)
tracing 444.394 µs [423.676 µs, 465.113 µs] 73.976 µs (20.0%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 372.856 µs [350.915 µs, 394.796 µs] -
iast 475.366 µs [455.18 µs, 495.552 µs] 102.51 µs (27.5%)
iast_FULL 538.548 µs [518.319 µs, 558.776 µs] 165.692 µs (44.4%)
iast_INACTIVE 454.781 µs [434.162 µs, 475.4 µs] 81.925 µs (22.0%)
iast_TELEMETRY_OFF 469.595 µs [448.872 µs, 490.319 µs] 96.74 µs (25.9%)
tracing 448.695 µs [428.02 µs, 469.371 µs] 75.839 µs (20.3%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.25.0-SNAPSHOT~a0060ff2ec, baseline=1.25.0-SNAPSHOT~cde4b1a75b
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.346 ms) : 1327, 1365
.   : milestone, 1346,
appsec (1.768 ms) : 1742, 1794
.   : milestone, 1768,
iast (1.562 ms) : 1538, 1586
.   : milestone, 1562,
profiling (1.577 ms) : 1550, 1604
.   : milestone, 1577,
tracing (1.52 ms) : 1494, 1545
.   : milestone, 1520,
section candidate
no_agent (1.383 ms) : 1364, 1402
.   : milestone, 1383,
appsec (1.791 ms) : 1766, 1817
.   : milestone, 1791,
iast (1.521 ms) : 1497, 1545
.   : milestone, 1521,
profiling (1.541 ms) : 1516, 1566
.   : milestone, 1541,
tracing (1.529 ms) : 1504, 1553
.   : milestone, 1529,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.346 ms [1.327 ms, 1.365 ms] -
appsec 1.768 ms [1.742 ms, 1.794 ms] 421.83 µs (31.3%)
iast 1.562 ms [1.538 ms, 1.586 ms] 216.174 µs (16.1%)
profiling 1.577 ms [1.55 ms, 1.604 ms] 230.898 µs (17.2%)
tracing 1.52 ms [1.494 ms, 1.545 ms] 173.578 µs (12.9%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.383 ms [1.364 ms, 1.402 ms] -
appsec 1.791 ms [1.766 ms, 1.817 ms] 408.35 µs (29.5%)
iast 1.521 ms [1.497 ms, 1.545 ms] 138.078 µs (10.0%)
profiling 1.541 ms [1.516 ms, 1.566 ms] 158.212 µs (11.4%)
tracing 1.529 ms [1.504 ms, 1.553 ms] 145.772 µs (10.5%)

@jpbempel jpbempel added the comp: debugger Dynamic Instrumentation label Nov 22, 2023
@jpbempel jpbempel changed the title Handle WellKnown classes as primitive to in EL Handle WellKnown classes as primitives in EL Nov 22, 2023
ExpressionHelper.throwRedactedException(this);
if (symbol != null) {
String typeName = symbol.getClass().getTypeName();
if (WellKnownClasses.isStringPrimitive(typeName)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this only after we check this is not redacted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid calling to string if the type/value is redact...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big deal, those toString are very cheap (and that's why we authorize them) and also very low chance that they would be redacted

}, {
"eq": [
{"ref": "clazz"},
"class java.lang.String"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this weird. I expected class to be just fully qualified name of the class. Same thing as we have instance of operator.

Maybe we should also provide a function to string those classes and instead calling toString we should just use the class name for this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I found it also weird.
I will add the special toString later

}, {
"eq": [
{"ref": "duration"},
"PT42S"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool

@jpbempel jpbempel merged commit 46fcb7c into master Nov 22, 2023
71 of 73 checks passed
@jpbempel jpbempel deleted the jpbempel/well-known-class-el branch November 22, 2023 16:39
@github-actions github-actions bot added this to the 1.25.0 milestone Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: debugger Dynamic Instrumentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants