From 0b3e313260de7bb9931909e71e4f84d176edb850 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sun, 30 Dec 2012 09:46:21 -0500 Subject: [PATCH] adding vulnerable software Former-commit-id: 8ce12bbab5ad294a3565f3f13e72611e3345168d --- .../dependency/Vulnerability.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/main/java/org/codesecure/dependencycheck/dependency/Vulnerability.java b/src/main/java/org/codesecure/dependencycheck/dependency/Vulnerability.java index adc7e1f20..6700d62b9 100644 --- a/src/main/java/org/codesecure/dependencycheck/dependency/Vulnerability.java +++ b/src/main/java/org/codesecure/dependencycheck/dependency/Vulnerability.java @@ -103,4 +103,63 @@ public class Vulnerability { public void addReference(Reference ref) { this.references.add(ref); } + + /** + * Adds a reference + * @param referenceSource the source of the referece + * @param referenceName the referenceName of the reference + * @param referenceUrl the url of the reference + */ + public void addReference(String referenceSource, String referenceName, String referenceUrl) { + Reference ref = new Reference(); + ref.setSource(referenceSource); + ref.setName(referenceName); + ref.setUrl(referenceUrl); + this.references.add(ref); + } + + + /** + * a list of vulnerable software + */ + protected List vulnerableSoftware; + + /** + * Get the value of vulnerableSoftware + * + * @return the value of vulnerableSoftware + */ + public List getVulnerableSoftware() { + return vulnerableSoftware; + } + + /** + * Set the value of vulnerableSoftware + * + * @param vulnerableSoftware new value of vulnerableSoftware + */ + public void setVulnerableSoftware(List vulnerableSoftware) { + this.vulnerableSoftware = vulnerableSoftware; + } + + /** + * Adds an entry for vulnerable software + * @param cpe string representation of a cpe + * @param previousVersion the previous version (previousVersion - cpe would be considered vulnerable) + */ + public void addVulnerableSoftware(String cpe, String previousVersion) { + VulnerableSoftware vs = new VulnerableSoftware(); + vs.setCpe(cpe); + if (previousVersion != null) { + vs.setPreviousVersion(previousVersion); + } + } + + /** + * Adds an entry for vulnerable software + * @param cpe string representation of a CPE entry + */ + public void addVulnerableSoftware(String cpe) { + addVulnerableSoftware(cpe, null); + } }