From 824d85b2a08e7ee2debef97d7263381425fdffbe Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Mon, 20 Jan 2014 08:21:12 -0500 Subject: [PATCH] added a new field to keep track of the vulnerable software that caused the match - part of the patch for issue 20 Former-commit-id: a5fa6313b9ecfb2d67ba4da25a2f5e863b184b51 --- .../dependency/Vulnerability.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) 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; + } }