-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved vulnerability reporting data
- Loading branch information
1 parent
e873cbd
commit 40c949b
Showing
4 changed files
with
24 additions
and
8 deletions.
There are no files selected for viewing
18 changes: 13 additions & 5 deletions
18
dd-java-agent/agent-iast/src/main/java/com/datadog/iast/sink/StacktraceLeakModuleImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
package com.datadog.iast.sink; | ||
|
||
import com.datadog.iast.model.Evidence; | ||
import com.datadog.iast.model.Location; | ||
import com.datadog.iast.model.Vulnerability; | ||
import com.datadog.iast.model.VulnerabilityType; | ||
import datadog.trace.api.Config; | ||
import datadog.trace.api.iast.sink.StacktraceLeakModule; | ||
import datadog.trace.bootstrap.instrumentation.api.AgentSpan; | ||
import datadog.trace.bootstrap.instrumentation.api.AgentTracer; | ||
|
||
public class StacktraceLeakModuleImpl extends SinkModuleBase implements StacktraceLeakModule { | ||
@Override | ||
public void onStacktraceLeak(Throwable throwable) { | ||
public void onStacktraceLeak( | ||
Throwable throwable, String moduleName, String className, String methodName) { | ||
if (throwable != null) { | ||
final AgentSpan span = AgentTracer.activeSpan(); | ||
String serviceName = Config.get().getServiceName(); | ||
|
||
Evidence evidence = | ||
new Evidence( | ||
"ExceptionHandler in " | ||
+ moduleName | ||
+ " \r\nthrown " | ||
+ throwable.getClass().getName()); | ||
Location location = Location.forSpanAndClassAndMethod(span, className, methodName); | ||
|
||
reporter.report( | ||
span, | ||
new Vulnerability(VulnerabilityType.STACKTRACE_LEAK, null, new Evidence(serviceName))); | ||
span, new Vulnerability(VulnerabilityType.STACKTRACE_LEAK, location, evidence)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters