Package com.tonic.analysis.cpg.taint
Class TaintAnalysisResult
- java.lang.Object
-
- com.tonic.analysis.cpg.taint.TaintAnalysisResult
-
public class TaintAnalysisResult extends Object
Collected taint paths from one analysis run, indexed by vulnerability type and severity.
-
-
Constructor Summary
Constructors Constructor Description TaintAnalysisResult()Creates an empty result.
-
Method Summary
-
-
-
Method Detail
-
getPathsByVulnerability
public Map<VulnerabilityType,List<TaintPath>> getPathsByVulnerability()
- Returns:
- the paths by vulnerability
-
getPathsBySeverity
public Map<Severity,List<TaintPath>> getPathsBySeverity()
- Returns:
- the paths by severity
-
addPath
public void addPath(TaintPath path)
Records a taint path under its vulnerability type and severity.- Parameters:
path- the path to record
-
getTotalVulnerabilities
public int getTotalVulnerabilities()
- Returns:
- the total number of recorded paths, sanitized included
-
getUnsanitizedCount
public int getUnsanitizedCount()
- Returns:
- the number of unsanitized paths
-
getSanitizedCount
public int getSanitizedCount()
- Returns:
- the number of sanitized paths
-
getUnsanitizedPaths
public List<TaintPath> getUnsanitizedPaths()
- Returns:
- the paths with no sanitizer on the way
-
getSanitizedPaths
public List<TaintPath> getSanitizedPaths()
- Returns:
- the paths that passed through a sanitizer
-
getPathsByVulnerability
public List<TaintPath> getPathsByVulnerability(VulnerabilityType type)
Looks up paths of one vulnerability type.- Parameters:
type- the vulnerability type- Returns:
- the matching paths, or an empty list
-
getPathsBySeverity
public List<TaintPath> getPathsBySeverity(Severity severity)
Looks up paths of one severity.- Parameters:
severity- the severity level- Returns:
- the matching paths, or an empty list
-
getCriticalPaths
public List<TaintPath> getCriticalPaths()
- Returns:
- the unsanitized paths of critical severity
-
hasVulnerabilities
public boolean hasVulnerabilities()
- Returns:
- whether any unsanitized path was found
-
hasCriticalVulnerabilities
public boolean hasCriticalVulnerabilities()
- Returns:
- whether any unsanitized critical path was found
-
getVulnerabilityCounts
public Map<VulnerabilityType,Integer> getVulnerabilityCounts()
Tallies unsanitized paths per vulnerability type.- Returns:
- a map from vulnerability type to path count
-
getSeverityCounts
public Map<Severity,Integer> getSeverityCounts()
Tallies unsanitized paths per severity.- Returns:
- a map from severity to path count
-
getSummary
public String getSummary()
Renders totals plus per-severity and per-type breakdowns.- Returns:
- a multi-line summary
-
getDetailedReport
public String getDetailedReport()
Renders the summary followed by each critical, high, and medium unsanitized path.- Returns:
- a multi-line report
-
-