-
Notifications
You must be signed in to change notification settings - Fork 292
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
Prevent errors linked to Security Manager when reading config #7846
base: master
Are you sure you want to change the base?
Conversation
…ecurity manager is in the way
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 56 metrics, 7 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.093 s) : 0, 1093205
Total [baseline] (10.489 s) : 0, 10489234
Agent [candidate] (1.082 s) : 0, 1082070
Total [candidate] (10.52 s) : 0, 10519862
section appsec
Agent [baseline] (1.217 s) : 0, 1216593
Total [baseline] (10.689 s) : 0, 10688713
Agent [candidate] (1.22 s) : 0, 1220348
Total [candidate] (10.736 s) : 0, 10735922
section iast
Agent [baseline] (1.211 s) : 0, 1210924
Total [baseline] (10.943 s) : 0, 10943231
Agent [candidate] (1.212 s) : 0, 1211727
Total [candidate] (10.989 s) : 0, 10988777
section profiling
Agent [baseline] (1.281 s) : 0, 1280800
Total [baseline] (10.726 s) : 0, 10725715
Agent [candidate] (1.298 s) : 0, 1297792
Total [candidate] (10.74 s) : 0, 10739734
gantt
title petclinic - break down per module: candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (693.998 ms) : 0, 693998
BytebuddyAgent [candidate] (687.494 ms) : 0, 687494
GlobalTracer [baseline] (318.354 ms) : 0, 318354
GlobalTracer [candidate] (316.413 ms) : 0, 316413
AppSec [baseline] (54.709 ms) : 0, 54709
AppSec [candidate] (54.332 ms) : 0, 54332
Remote Config [baseline] (691.777 µs) : 0, 692
Remote Config [candidate] (684.664 µs) : 0, 685
Telemetry [baseline] (11.576 ms) : 0, 11576
Telemetry [candidate] (9.39 ms) : 0, 9390
section appsec
BytebuddyAgent [baseline] (703.697 ms) : 0, 703697
BytebuddyAgent [candidate] (706.094 ms) : 0, 706094
GlobalTracer [baseline] (313.46 ms) : 0, 313460
GlobalTracer [candidate] (314.895 ms) : 0, 314895
AppSec [baseline] (167.304 ms) : 0, 167304
AppSec [candidate] (166.913 ms) : 0, 166913
Remote Config [baseline] (644.09 µs) : 0, 644
Remote Config [candidate] (646.617 µs) : 0, 647
Telemetry [baseline] (7.529 ms) : 0, 7529
Telemetry [candidate] (8.576 ms) : 0, 8576
IAST [baseline] (20.447 ms) : 0, 20447
IAST [candidate] (18.892 ms) : 0, 18892
section iast
BytebuddyAgent [baseline] (805.036 ms) : 0, 805036
BytebuddyAgent [candidate] (805.64 ms) : 0, 805640
GlobalTracer [baseline] (305.49 ms) : 0, 305490
GlobalTracer [candidate] (305.762 ms) : 0, 305762
AppSec [baseline] (57.073 ms) : 0, 57073
AppSec [candidate] (57.693 ms) : 0, 57693
Remote Config [baseline] (616.293 µs) : 0, 616
Remote Config [candidate] (630.804 µs) : 0, 631
Telemetry [baseline] (7.459 ms) : 0, 7459
Telemetry [candidate] (7.525 ms) : 0, 7525
IAST [baseline] (21.409 ms) : 0, 21409
IAST [candidate] (20.648 ms) : 0, 20648
section profiling
BytebuddyAgent [baseline] (681.062 ms) : 0, 681062
BytebuddyAgent [candidate] (691.854 ms) : 0, 691854
GlobalTracer [baseline] (400.155 ms) : 0, 400155
GlobalTracer [candidate] (403.807 ms) : 0, 403807
AppSec [baseline] (54.847 ms) : 0, 54847
AppSec [candidate] (55.257 ms) : 0, 55257
Remote Config [baseline] (665.295 µs) : 0, 665
Remote Config [candidate] (671.188 µs) : 0, 671
Telemetry [baseline] (12.139 ms) : 0, 12139
Telemetry [candidate] (13.541 ms) : 0, 13541
ProfilingAgent [baseline] (92.949 ms) : 0, 92949
ProfilingAgent [candidate] (92.691 ms) : 0, 92691
Profiling [baseline] (92.972 ms) : 0, 92972
Profiling [candidate] (92.715 ms) : 0, 92715
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.085 s) : 0, 1084813
Total [baseline] (8.616 s) : 0, 8615782
Agent [candidate] (1.083 s) : 0, 1083200
Total [candidate] (8.584 s) : 0, 8584196
section iast
Agent [baseline] (1.221 s) : 0, 1220586
Total [baseline] (9.161 s) : 0, 9160664
Agent [candidate] (1.211 s) : 0, 1210615
Total [candidate] (9.204 s) : 0, 9204005
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.219 s) : 0, 1218704
Total [baseline] (9.146 s) : 0, 9145744
Agent [candidate] (1.211 s) : 0, 1210638
Total [candidate] (9.144 s) : 0, 9143904
section iast_TELEMETRY_OFF
Agent [baseline] (1.223 s) : 0, 1223231
Total [baseline] (9.155 s) : 0, 9154978
Agent [candidate] (1.212 s) : 0, 1211851
Total [candidate] (9.137 s) : 0, 9137488
gantt
title insecure-bank - break down per module: candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (689.046 ms) : 0, 689046
BytebuddyAgent [candidate] (688.546 ms) : 0, 688546
GlobalTracer [baseline] (316.746 ms) : 0, 316746
GlobalTracer [candidate] (316.668 ms) : 0, 316668
AppSec [baseline] (54.467 ms) : 0, 54467
AppSec [candidate] (54.234 ms) : 0, 54234
Remote Config [baseline] (688.147 µs) : 0, 688
Remote Config [candidate] (678.143 µs) : 0, 678
Telemetry [baseline] (10.04 ms) : 0, 10040
Telemetry [candidate] (9.237 ms) : 0, 9237
section iast
BytebuddyAgent [baseline] (812.154 ms) : 0, 812154
BytebuddyAgent [candidate] (804.599 ms) : 0, 804599
GlobalTracer [baseline] (308.013 ms) : 0, 308013
GlobalTracer [candidate] (305.898 ms) : 0, 305898
AppSec [baseline] (58.032 ms) : 0, 58032
AppSec [candidate] (57.524 ms) : 0, 57524
IAST [baseline] (20.438 ms) : 0, 20438
IAST [candidate] (20.642 ms) : 0, 20642
Remote Config [baseline] (624.799 µs) : 0, 625
Remote Config [candidate] (623.787 µs) : 0, 624
Telemetry [baseline] (7.408 ms) : 0, 7408
Telemetry [candidate] (7.463 ms) : 0, 7463
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (809.464 ms) : 0, 809464
BytebuddyAgent [candidate] (804.604 ms) : 0, 804604
GlobalTracer [baseline] (308.015 ms) : 0, 308015
GlobalTracer [candidate] (305.723 ms) : 0, 305723
AppSec [baseline] (58.071 ms) : 0, 58071
AppSec [candidate] (57.539 ms) : 0, 57539
IAST [baseline] (21.029 ms) : 0, 21029
IAST [candidate] (20.828 ms) : 0, 20828
Remote Config [baseline] (626.101 µs) : 0, 626
Remote Config [candidate] (619.069 µs) : 0, 619
Telemetry [baseline] (7.601 ms) : 0, 7601
Telemetry [candidate] (7.486 ms) : 0, 7486
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (812.938 ms) : 0, 812938
BytebuddyAgent [candidate] (804.426 ms) : 0, 804426
GlobalTracer [baseline] (309.286 ms) : 0, 309286
GlobalTracer [candidate] (306.903 ms) : 0, 306903
AppSec [baseline] (58.554 ms) : 0, 58554
AppSec [candidate] (58.422 ms) : 0, 58422
IAST [baseline] (20.444 ms) : 0, 20444
IAST [candidate] (20.205 ms) : 0, 20205
Remote Config [baseline] (613.013 µs) : 0, 613
Remote Config [candidate] (608.31 µs) : 0, 608
Telemetry [baseline] (7.428 ms) : 0, 7428
Telemetry [candidate] (7.423 ms) : 0, 7423
LoadParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 16 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section baseline
no_agent (1.332 ms) : 1313, 1351
. : milestone, 1332,
appsec (1.732 ms) : 1708, 1756
. : milestone, 1732,
appsec_no_iast (1.724 ms) : 1698, 1749
. : milestone, 1724,
iast (1.484 ms) : 1462, 1506
. : milestone, 1484,
profiling (1.562 ms) : 1538, 1587
. : milestone, 1562,
tracing (1.504 ms) : 1480, 1528
. : milestone, 1504,
section candidate
no_agent (1.343 ms) : 1325, 1362
. : milestone, 1343,
appsec (1.723 ms) : 1698, 1747
. : milestone, 1723,
appsec_no_iast (1.732 ms) : 1708, 1756
. : milestone, 1732,
iast (1.477 ms) : 1455, 1500
. : milestone, 1477,
profiling (1.49 ms) : 1467, 1513
. : milestone, 1490,
tracing (1.498 ms) : 1474, 1522
. : milestone, 1498,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section baseline
no_agent (377.159 µs) : 357, 397
. : milestone, 377,
iast (489.552 µs) : 468, 511
. : milestone, 490,
iast_FULL (648.81 µs) : 628, 670
. : milestone, 649,
iast_GLOBAL (514.684 µs) : 493, 537
. : milestone, 515,
iast_HARDCODED_SECRET_DISABLED (491.319 µs) : 469, 513
. : milestone, 491,
iast_INACTIVE (448.039 µs) : 427, 469
. : milestone, 448,
iast_TELEMETRY_OFF (478.999 µs) : 457, 501
. : milestone, 479,
tracing (456.55 µs) : 436, 477
. : milestone, 457,
section candidate
no_agent (366.809 µs) : 346, 387
. : milestone, 367,
iast (488.406 µs) : 467, 510
. : milestone, 488,
iast_FULL (642.592 µs) : 621, 664
. : milestone, 643,
iast_GLOBAL (515.2 µs) : 493, 537
. : milestone, 515,
iast_HARDCODED_SECRET_DISABLED (482.244 µs) : 461, 503
. : milestone, 482,
iast_INACTIVE (445.272 µs) : 425, 466
. : milestone, 445,
iast_TELEMETRY_OFF (473.641 µs) : 452, 495
. : milestone, 474,
tracing (450.571 µs) : 429, 472
. : milestone, 451,
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.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section baseline
no_agent (15.434 s) : 15434000, 15434000
. : milestone, 15434000,
appsec (15.374 s) : 15374000, 15374000
. : milestone, 15374000,
iast (18.981 s) : 18981000, 18981000
. : milestone, 18981000,
iast_GLOBAL (18.145 s) : 18145000, 18145000
. : milestone, 18145000,
profiling (14.898 s) : 14898000, 14898000
. : milestone, 14898000,
tracing (15.039 s) : 15039000, 15039000
. : milestone, 15039000,
section candidate
no_agent (15.273 s) : 15273000, 15273000
. : milestone, 15273000,
appsec (15.271 s) : 15271000, 15271000
. : milestone, 15271000,
iast (18.625 s) : 18625000, 18625000
. : milestone, 18625000,
iast_GLOBAL (18.245 s) : 18245000, 18245000
. : milestone, 18245000,
profiling (15.217 s) : 15217000, 15217000
. : milestone, 15217000,
tracing (14.973 s) : 14973000, 14973000
. : milestone, 14973000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~316d0e13dc, baseline=1.43.0-SNAPSHOT~59388f19c2
dateFormat X
axisFormat %s
section baseline
no_agent (1.465 ms) : 1453, 1476
. : milestone, 1465,
appsec (2.344 ms) : 2303, 2386
. : milestone, 2344,
iast (2.074 ms) : 2022, 2126
. : milestone, 2074,
iast_GLOBAL (2.125 ms) : 2073, 2177
. : milestone, 2125,
profiling (1.938 ms) : 1897, 1980
. : milestone, 1938,
tracing (1.929 ms) : 1888, 1969
. : milestone, 1929,
section candidate
no_agent (1.466 ms) : 1454, 1477
. : milestone, 1466,
appsec (2.343 ms) : 2301, 2385
. : milestone, 2343,
iast (2.081 ms) : 2028, 2133
. : milestone, 2081,
iast_GLOBAL (2.122 ms) : 2070, 2174
. : milestone, 2122,
profiling (1.945 ms) : 1903, 1987
. : milestone, 1945,
tracing (1.928 ms) : 1887, 1969
. : milestone, 1928,
|
I'll work on the tests for this as part of my APM Ecosystems mentorship, learning java! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good addition would be to add the wrapped method into the forbidden APIs to prevent devs to use them any more.
oh I missed this comment ! Feel free to, but it's not the easiest task to start with ! Some tests are failing because we are using the logger "too early". We probably need to change the code to store a flag if we couldn't access the settings we wanted, and check it later, when the initialization is done, to log something. |
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java
Outdated
Show resolved
Hide resolved
Should we move it to a draft state as there are still things to address, such as logging too early and marking old APIs as forbidden? |
Ah yes maybe I need to edit the description, but we're not logging too early anymore. |
} | ||
|
||
public static String tryGetProperty(String property) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just be getPropertyOrDefault(property, null)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What Does This Do
extends the logic implemented by @dougqh for the bootstrap in https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/src/main/java/datadog/trace/bootstrap/SystemUtils.java to the rest of the codebase.
Motivation
The Java Security Manager can prevent us from accessing some env variables or system properties, but we should fallback to default values rather than crash when this happens.
Additional Notes
I added a warning log, because if we completely swallow those errors, it can get very confusing to the customers why their configs are not applied. We can also provide some guidance on how to fix the issue.
Also, I wasn't sure where to put the boundary between where we can fallback to a default value, and where we really expect to get something. For instance, there is still a bunch of unprotected
getProperty
in https://github.com/DataDog/dd-trace-java/blob/5622bdce6e5405a56e8fa7985d696e15ebb6dafb/internal-api/src/main/java/datadog/trace/api/Platform.java and also here:dd-trace-java/internal-api/src/main/java/datadog/trace/api/Config.java
Lines 3263 to 3268 in 5c54fec
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: APMS-13069