File tree Expand file tree Collapse file tree 4 files changed +19
-19
lines changed
dd-java-agent/agent-iast/src
main/java/com/datadog/iast
test/groovy/com/datadog/iast Expand file tree Collapse file tree 4 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ private void reportVulnerability(
8080 String stackId =
8181 addVulnerabilityStackTrace (span , String .valueOf (batch .getVulnerabilities ().size ()));
8282 if (stackId != null ) {
83- vulnerability .setStackId (stackId );
83+ vulnerability .getLocation (). setStackId (stackId );
8484 }
8585 }
8686 }
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ public final class Location {
1515
1616 @ Nullable private transient String serviceName ;
1717
18+ private @ Nullable String stackId ;
19+
1820 private Location (
1921 @ Nullable final Long spanId ,
2022 @ Nullable final String path ,
@@ -86,6 +88,15 @@ public void updateSpan(@Nullable final AgentSpan span) {
8688 }
8789 }
8890
91+ @ Nullable
92+ public String getStackId () {
93+ return stackId ;
94+ }
95+
96+ public void setStackId (@ Nullable String stackId ) {
97+ this .stackId = stackId ;
98+ }
99+
89100 @ Nullable
90101 private static Long spanId (@ Nullable AgentSpan span ) {
91102 return span != null ? span .getSpanId () : null ;
Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ public final class Vulnerability {
1212
1313 private final @ Nullable Evidence evidence ;
1414
15- private @ Nullable String stackId ;
16-
1715 private long hash ;
1816
1917 public Vulnerability (@ Nonnull final VulnerabilityType type , @ Nonnull final Location location ) {
@@ -45,15 +43,6 @@ public Evidence getEvidence() {
4543 return evidence ;
4644 }
4745
48- @ Nullable
49- public String getStackId () {
50- return stackId ;
51- }
52-
53- public void setStackId (@ Nullable String stackId ) {
54- this .stackId = stackId ;
55- }
56-
5746 public long getHash () {
5847 return hash ;
5948 }
Original file line number Diff line number Diff line change @@ -77,9 +77,9 @@ class ReporterTest extends DDSpecification {
7777 "spanId":123456,
7878 "line":1,
7979 "path": "foo",
80- "method": "foo"
80+ "method": "foo",
81+ "stackId":"1"
8182 },
82- "stackId":"1",
8383 "type":"WEAK_HASH"
8484 }
8585 ]
@@ -186,9 +186,9 @@ class ReporterTest extends DDSpecification {
186186 "spanId":123456,
187187 "line":1,
188188 "path":"foo",
189- "method": "foo"
189+ "method": "foo",
190+ "stackId":"1"
190191 },
191- "stackId":"1",
192192 "type":"WEAK_HASH"
193193 },
194194 {
@@ -198,9 +198,9 @@ class ReporterTest extends DDSpecification {
198198 "spanId":123456,
199199 "line":2,
200200 "path":"foo",
201- "method": "foo"
201+ "method": "foo",
202+ "stackId":"2"
202203 },
203- "stackId":"2",
204204 "type":"WEAK_HASH"
205205 }
206206 ]
@@ -577,7 +577,7 @@ class ReporterTest extends DDSpecification {
577577 StackTraceEvent currentStackTrace = null
578578 for (int i = 0 ; i < vulnerabilities. size(); i++ ) {
579579 for (StackTraceEvent event : batch. get(" vulnerability" )) {
580- if (event. getId() == vulnerabilities[i]. getStackId()) {
580+ if (event. getId() == vulnerabilities[i]. getLocation() . getStackId()) {
581581 currentStackTrace = event
582582 break
583583 }
You can’t perform that action at this time.
0 commit comments