-
Notifications
You must be signed in to change notification settings - Fork 315
Fix IllegalFormatConversionException StringModuleImpl#onStringFormat #9907
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
base: master
Are you sure you want to change the base?
Fix IllegalFormatConversionException StringModuleImpl#onStringFormat #9907
Conversation
|
🎯 Code Coverage 🔗 Commit SHA: e0cf863 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 6 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.101 s) : 0, 1101495
Total [baseline] (10.891 s) : 0, 10890501
Agent [candidate] (1.1 s) : 0, 1099665
Total [candidate] (10.734 s) : 0, 10733838
section appsec
Agent [baseline] (1.278 s) : 0, 1277600
Total [baseline] (11.023 s) : 0, 11022546
Agent [candidate] (1.278 s) : 0, 1278376
Total [candidate] (11.025 s) : 0, 11024758
section iast
Agent [baseline] (1.236 s) : 0, 1236080
Total [baseline] (11.242 s) : 0, 11241889
Agent [candidate] (1.242 s) : 0, 1242344
Total [candidate] (11.244 s) : 0, 11244227
section profiling
Agent [baseline] (1.224 s) : 0, 1223649
Total [baseline] (11.005 s) : 0, 11005325
Agent [candidate] (1.227 s) : 0, 1227073
Total [candidate] (11.054 s) : 0, 11053862
gantt
title petclinic - break down per module: candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.464 ms) : 0, 1464
crashtracking [candidate] (1.455 ms) : 0, 1455
BytebuddyAgent [baseline] (708.181 ms) : 0, 708181
BytebuddyAgent [candidate] (706.597 ms) : 0, 706597
GlobalTracer [baseline] (248.107 ms) : 0, 248107
GlobalTracer [candidate] (248.107 ms) : 0, 248107
AppSec [baseline] (32.156 ms) : 0, 32156
AppSec [candidate] (32.033 ms) : 0, 32033
Debugger [baseline] (64.399 ms) : 0, 64399
Debugger [candidate] (64.294 ms) : 0, 64294
Remote Config [baseline] (632.838 µs) : 0, 633
Remote Config [candidate] (621.969 µs) : 0, 622
Telemetry [baseline] (8.149 ms) : 0, 8149
Telemetry [candidate] (8.213 ms) : 0, 8213
Flare Poller [baseline] (3.637 ms) : 0, 3637
Flare Poller [candidate] (3.668 ms) : 0, 3668
section appsec
crashtracking [baseline] (1.453 ms) : 0, 1453
crashtracking [candidate] (1.454 ms) : 0, 1454
BytebuddyAgent [baseline] (727.908 ms) : 0, 727908
BytebuddyAgent [candidate] (729.695 ms) : 0, 729695
GlobalTracer [baseline] (239.954 ms) : 0, 239954
GlobalTracer [candidate] (240.207 ms) : 0, 240207
AppSec [baseline] (174.765 ms) : 0, 174765
AppSec [candidate] (173.742 ms) : 0, 173742
Debugger [baseline] (61.108 ms) : 0, 61108
Debugger [candidate] (60.939 ms) : 0, 60939
Remote Config [baseline] (730.478 µs) : 0, 730
Remote Config [candidate] (692.255 µs) : 0, 692
Telemetry [baseline] (8.298 ms) : 0, 8298
Telemetry [candidate] (8.28 ms) : 0, 8280
Flare Poller [baseline] (3.851 ms) : 0, 3851
Flare Poller [candidate] (3.828 ms) : 0, 3828
IAST [baseline] (24.697 ms) : 0, 24697
IAST [candidate] (24.713 ms) : 0, 24713
section iast
crashtracking [baseline] (1.451 ms) : 0, 1451
crashtracking [candidate] (1.454 ms) : 0, 1454
BytebuddyAgent [baseline] (828.571 ms) : 0, 828571
BytebuddyAgent [candidate] (834.236 ms) : 0, 834236
GlobalTracer [baseline] (237.986 ms) : 0, 237986
GlobalTracer [candidate] (238.32 ms) : 0, 238320
AppSec [baseline] (29.77 ms) : 0, 29770
AppSec [candidate] (29.599 ms) : 0, 29599
Debugger [baseline] (60.342 ms) : 0, 60342
Debugger [candidate] (60.587 ms) : 0, 60587
Remote Config [baseline] (541.188 µs) : 0, 541
Remote Config [candidate] (534.007 µs) : 0, 534
Telemetry [baseline] (7.637 ms) : 0, 7637
Telemetry [candidate] (7.615 ms) : 0, 7615
Flare Poller [baseline] (3.466 ms) : 0, 3466
Flare Poller [candidate] (3.434 ms) : 0, 3434
IAST [baseline] (31.61 ms) : 0, 31610
IAST [candidate] (31.694 ms) : 0, 31694
section profiling
crashtracking [baseline] (1.44 ms) : 0, 1440
crashtracking [candidate] (1.428 ms) : 0, 1428
BytebuddyAgent [baseline] (727.314 ms) : 0, 727314
BytebuddyAgent [candidate] (729.422 ms) : 0, 729422
GlobalTracer [baseline] (221.099 ms) : 0, 221099
GlobalTracer [candidate] (221.878 ms) : 0, 221878
AppSec [baseline] (32.083 ms) : 0, 32083
AppSec [candidate] (32.26 ms) : 0, 32260
Debugger [baseline] (62.859 ms) : 0, 62859
Debugger [candidate] (62.596 ms) : 0, 62596
Remote Config [baseline] (652.87 µs) : 0, 653
Remote Config [candidate] (655.953 µs) : 0, 656
Telemetry [baseline] (7.931 ms) : 0, 7931
Telemetry [candidate] (7.917 ms) : 0, 7917
Flare Poller [baseline] (3.812 ms) : 0, 3812
Flare Poller [candidate] (3.775 ms) : 0, 3775
ProfilingAgent [baseline] (96.977 ms) : 0, 96977
ProfilingAgent [candidate] (97.626 ms) : 0, 97626
Profiling [baseline] (97.562 ms) : 0, 97562
Profiling [candidate] (98.206 ms) : 0, 98206
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.105 s) : 0, 1105387
Total [baseline] (8.818 s) : 0, 8817869
Agent [candidate] (1.097 s) : 0, 1096611
Total [candidate] (8.816 s) : 0, 8815549
section iast
Agent [baseline] (1.234 s) : 0, 1233505
Total [baseline] (9.551 s) : 0, 9550954
Agent [candidate] (1.235 s) : 0, 1235334
Total [candidate] (9.527 s) : 0, 9526988
gantt
title insecure-bank - break down per module: candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.507 ms) : 0, 1507
crashtracking [candidate] (1.448 ms) : 0, 1448
BytebuddyAgent [baseline] (710.988 ms) : 0, 710988
BytebuddyAgent [candidate] (705.076 ms) : 0, 705076
GlobalTracer [baseline] (249.15 ms) : 0, 249150
GlobalTracer [candidate] (247.675 ms) : 0, 247675
AppSec [baseline] (32.499 ms) : 0, 32499
AppSec [candidate] (32.251 ms) : 0, 32251
Debugger [baseline] (63.721 ms) : 0, 63721
Debugger [candidate] (63.136 ms) : 0, 63136
Remote Config [baseline] (645.074 µs) : 0, 645
Remote Config [candidate] (634.913 µs) : 0, 635
Telemetry [baseline] (8.241 ms) : 0, 8241
Telemetry [candidate] (8.079 ms) : 0, 8079
Flare Poller [baseline] (3.694 ms) : 0, 3694
Flare Poller [candidate] (3.669 ms) : 0, 3669
section iast
crashtracking [baseline] (1.466 ms) : 0, 1466
crashtracking [candidate] (1.454 ms) : 0, 1454
BytebuddyAgent [baseline] (826.945 ms) : 0, 826945
BytebuddyAgent [candidate] (828.345 ms) : 0, 828345
GlobalTracer [baseline] (236.907 ms) : 0, 236907
GlobalTracer [candidate] (237.393 ms) : 0, 237393
AppSec [baseline] (33.158 ms) : 0, 33158
AppSec [candidate] (34.205 ms) : 0, 34205
Debugger [baseline] (60.163 ms) : 0, 60163
Debugger [candidate] (60.143 ms) : 0, 60143
Remote Config [baseline] (546.192 µs) : 0, 546
Remote Config [candidate] (537.466 µs) : 0, 537
Telemetry [baseline] (7.659 ms) : 0, 7659
Telemetry [candidate] (7.66 ms) : 0, 7660
Flare Poller [baseline] (3.451 ms) : 0, 3451
Flare Poller [candidate] (3.458 ms) : 0, 3458
IAST [baseline] (28.428 ms) : 0, 28428
IAST [candidate] (27.367 ms) : 0, 27367
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 insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section baseline
no_agent (1.182 ms) : 1171, 1194
. : milestone, 1182,
iast (3.256 ms) : 3207, 3304
. : milestone, 3256,
iast_FULL (6.0 ms) : 5938, 6061
. : milestone, 6000,
iast_GLOBAL (3.569 ms) : 3509, 3629
. : milestone, 3569,
profiling (2.005 ms) : 1987, 2023
. : milestone, 2005,
tracing (1.831 ms) : 1816, 1847
. : milestone, 1831,
section candidate
no_agent (1.175 ms) : 1164, 1186
. : milestone, 1175,
iast (3.325 ms) : 3279, 3371
. : milestone, 3325,
iast_FULL (5.615 ms) : 5558, 5671
. : milestone, 5615,
iast_GLOBAL (3.427 ms) : 3378, 3476
. : milestone, 3427,
profiling (2.031 ms) : 2013, 2050
. : milestone, 2031,
tracing (1.821 ms) : 1806, 1836
. : milestone, 1821,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section baseline
no_agent (18.135 ms) : 17950, 18320
. : milestone, 18135,
appsec (19.067 ms) : 18874, 19260
. : milestone, 19067,
code_origins (18.09 ms) : 17909, 18271
. : milestone, 18090,
iast (17.967 ms) : 17785, 18148
. : milestone, 17967,
profiling (19.942 ms) : 19733, 20151
. : milestone, 19942,
tracing (17.645 ms) : 17469, 17820
. : milestone, 17645,
section candidate
no_agent (19.409 ms) : 19208, 19610
. : milestone, 19409,
appsec (18.838 ms) : 18646, 19030
. : milestone, 18838,
code_origins (17.959 ms) : 17779, 18139
. : milestone, 17959,
iast (17.814 ms) : 17637, 17991
. : milestone, 17814,
profiling (18.56 ms) : 18378, 18741
. : milestone, 18560,
tracing (17.497 ms) : 17325, 17669
. : milestone, 17497,
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 biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section baseline
no_agent (15.283 s) : 15283000, 15283000
. : milestone, 15283000,
appsec (15.012 s) : 15012000, 15012000
. : milestone, 15012000,
iast (18.428 s) : 18428000, 18428000
. : milestone, 18428000,
iast_GLOBAL (17.996 s) : 17996000, 17996000
. : milestone, 17996000,
profiling (15.064 s) : 15064000, 15064000
. : milestone, 15064000,
tracing (14.817 s) : 14817000, 14817000
. : milestone, 14817000,
section candidate
no_agent (15.243 s) : 15243000, 15243000
. : milestone, 15243000,
appsec (14.673 s) : 14673000, 14673000
. : milestone, 14673000,
iast (17.969 s) : 17969000, 17969000
. : milestone, 17969000,
iast_GLOBAL (18.051 s) : 18051000, 18051000
. : milestone, 18051000,
profiling (15.015 s) : 15015000, 15015000
. : milestone, 15015000,
tracing (14.547 s) : 14547000, 14547000
. : milestone, 14547000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~e0cf863f61, baseline=1.56.0-SNAPSHOT~37a6360670
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1462, 1485
. : milestone, 1473,
appsec (3.728 ms) : 3508, 3949
. : milestone, 3728,
iast (2.212 ms) : 2148, 2277
. : milestone, 2212,
iast_GLOBAL (2.257 ms) : 2192, 2322
. : milestone, 2257,
profiling (2.062 ms) : 2009, 2115
. : milestone, 2062,
tracing (2.032 ms) : 1981, 2083
. : milestone, 2032,
section candidate
no_agent (1.472 ms) : 1461, 1484
. : milestone, 1472,
appsec (3.662 ms) : 3446, 3879
. : milestone, 3662,
iast (2.213 ms) : 2148, 2278
. : milestone, 2213,
iast_GLOBAL (2.257 ms) : 2192, 2322
. : milestone, 2257,
profiling (2.053 ms) : 2001, 2106
. : milestone, 2053,
tracing (2.027 ms) : 1976, 2077
. : milestone, 2027,
|
| implementation project(':dd-trace-api') | ||
| implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.5.4' | ||
| implementation libs.scala | ||
| implementation libs.scala213 |
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.
I've changed scala version just to reproduce the same stacktrace reported in the issue tracker. I feel that is not necessary to duplicate this test as is also covered by unit testing
…Exception-StringModuleImpl#onStringFormat
...sts/iast-propagation/src/test/groovy/datadog/smoketest/IastUnwrapScakaNumberSmokeTest.groovy
Show resolved
Hide resolved
...strumentation/scala/src/main/java/datadog/trace/instrumentation/scala/StringOpsCallSite.java
Outdated
Show resolved
Hide resolved
…Exception-StringModuleImpl#onStringFormat
What Does This Do
Fixes
IllegalFormatConversionExceptionin IAST when Scala's BigDecimal/BigInt are used withString.format().Added
unwrapScalaNumbers()inStringOpsCallSitethat:scala.math.ScalaNumberinstances via reflectionunderlying()method to extract Java numeric types (java.math.BigDecimal,java.math.BigInteger)This ensures type compatibility while preserving IAST taint tracking.
Enhanced
formatValue()error handling to catchIllegalFormatExceptionand log telemetry with parameter type information. This provides context for detecting similar format conversion bugs in the future while maintaining existing exception behavior.Motivation
Error tracking report
stack trace
Additional Notes
Scala's
String.format()internally callsunwrapArg()to convert scala.math.BigDecimal → java.math.BigDecimal before formatting. However, IAST's@CallSite.Afterinterceptor captures arguments after Scala execution completes, receiving the original Scala types. This causesIllegalFormatConversionExceptionwhenStringModuleImpl#formatValueattempts to format with incompatible types.Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: APPSEC-59883