diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java index 5ba17ef2d..fe54b3955 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/dependency/Vulnerability.java @@ -393,4 +393,52 @@ public class Vulnerability implements Serializable, Comparable { public int compareTo(Vulnerability v) { return v.getName().compareTo(this.getName()); } + + /** + * The CPE id that caused this vulnerability to be flagged. + */ + private String matchedCPE; + /** + * Whether or not all previous versions were affected. + */ + private String matchedAllPreviousCPE; + + /** + * Sets the CPE that caused this vulnerability to be flagged. + * + * @param cpeId a CPE identifier + * @param previous a flag indicating whether or not all previous versions were affected (any non-null value is + * considered true) + */ + public void setMatchedCPE(String cpeId, String previous) { + matchedCPE = cpeId; + matchedAllPreviousCPE = previous; + } + + /** + * Get the value of matchedCPE. + * + * @return the value of matchedCPE + */ + public String getMatchedCPE() { + return matchedCPE; + } + + /** + * Get the value of matchedAllPreviousCPE. + * + * @return the value of matchedAllPreviousCPE + */ + public String getMatchedAllPreviousCPE() { + return matchedAllPreviousCPE; + } + + /** + * Determines whether or not matchedAllPreviousCPE has been set. + * + * @return true if matchedAllPreviousCPE is not null; otherwise false + */ + public boolean hasMatchedAllPreviousCPE() { + return matchedAllPreviousCPE != null; + } }