Class Vulnerability
java.lang.Object
org.owasp.dependencycheck.dependency.Vulnerability
- All Implemented Interfaces:
Serializable, Comparable<Vulnerability>
@NotThreadSafe
public class Vulnerability
extends Object
implements Serializable, Comparable<Vulnerability>
Contains the information about a vulnerability.
- Author:
- Jeremy Long
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration for the source of vulnerability. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Vulnerability(String name) Constructs a new Vulnerability by its name. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a CWE to the set.voidaddReference(String referenceSource, String referenceName, String referenceUrl) Adds a reference.voidaddReference(Reference ref) Adds a reference to the references collection.voidaddReferences(Set<Reference> references) Adds the references to the collection.voidaddVulnerableSoftware(Set<VulnerableSoftware> vulnerableSoftware) Adds the vulnerableSoftware to the collection.voidaddVulnerableSoftware(VulnerableSoftware software) Adds an entry for vulnerable software.intcompareTo(@NonNull Vulnerability o) Compares two vulnerabilities.
Natural order of vulnerabilities is defined as decreasing in severity and alphabetically by name for equal severity.booleanio.github.jeremylong.openvulnerability.client.nvd.CvssV2Get the CVSS V2 scoring information.io.github.jeremylong.openvulnerability.client.nvd.CvssV3Get the CVSS V3 scoring information.io.github.jeremylong.openvulnerability.client.nvd.CvssV4Get the CVSS V3 scoring information.getCwes()Get the set of CWEs.Get the value of description.The report text to use for highest severity when this issue is ranked highest.Get the value of knownExploitedVulnerability.Get the value of matchedVulnerableSoftware.getName()Get the value of name.getNotes()Get the value of notes from suppression notes.Get the value of references.getReferences(boolean sorted) Returns the list of references.Returns the source that identified the vulnerability.Retrieves the severity aVulnerability.Sourcehas assigned for which a CVSS score is not available.Get the value of vulnerableSoftware.getVulnerableSoftware(boolean sorted) Returns a sorted list of vulnerable software.inthashCode()voidremoveVulnerableSoftware(Set<VulnerableSoftware> vulnerableSoftware) Removes the specified vulnerableSoftware from the collection.voidsetCvssV2(io.github.jeremylong.openvulnerability.client.nvd.CvssV2 cvssV2) Sets the CVSS V2 scoring information.voidsetCvssV3(io.github.jeremylong.openvulnerability.client.nvd.CvssV3 cvssV3) Sets the CVSS V3 scoring information.voidsetCvssV4(io.github.jeremylong.openvulnerability.client.nvd.CvssV4 cvssV4) Sets the CVSS V4 scoring information.voidsetDescription(String description) Set the value of description.voidAdds information about known exploited vulnerabilities.voidSets the CPE that caused this vulnerability to be flagged.voidSet the value of name.voidSet the value of notes.voidsetSource(Vulnerability.Source source) Sets the source that identified the vulnerability.voidsetUnscoredSeverity(String unscoredSeverity) Sets the severity aVulnerability.Sourcehas assigned for which a CVSS score is not available.toString()
-
Constructor Details
-
Vulnerability
public Vulnerability()Default constructor. -
Vulnerability
Constructs a new Vulnerability by its name.- Parameters:
name- the name of the vulnerability
-
-
Method Details
-
getName
-
setName
-
getDescription
-
setDescription
Set the value of description.- Parameters:
description- new value of description
-
getReferences
-
getReferences
-
addReferences
-
addReference
Adds a reference to the references collection.- Parameters:
ref- a reference for the vulnerability
-
addReference
-
setKnownExploitedVulnerability
Adds information about known exploited vulnerabilities.- Parameters:
kev- the known exploited vulnerability information
-
getKnownExploitedVulnerability
Get the value of knownExploitedVulnerability.- Returns:
- the value of knownExploitedVulnerability
-
getVulnerableSoftware
Get the value of vulnerableSoftware.- Returns:
- the value of vulnerableSoftware
-
getVulnerableSoftware
Returns a sorted list of vulnerable software. This is primarily used for display within reports.- Parameters:
sorted- whether or not the list should be sorted- Returns:
- the list of vulnerable software
-
removeVulnerableSoftware
Removes the specified vulnerableSoftware from the collection.- Parameters:
vulnerableSoftware- a collection of vulnerable software to be removed
-
addVulnerableSoftware
Adds the vulnerableSoftware to the collection.- Parameters:
vulnerableSoftware- a collection of vulnerable software
-
addVulnerableSoftware
Adds an entry for vulnerable software.- Parameters:
software- the vulnerable software reference to add
-
getCvssV2
public io.github.jeremylong.openvulnerability.client.nvd.CvssV2 getCvssV2()Get the CVSS V2 scoring information.- Returns:
- the CVSS V2 scoring information
-
setCvssV2
public void setCvssV2(io.github.jeremylong.openvulnerability.client.nvd.CvssV2 cvssV2) Sets the CVSS V2 scoring information.- Parameters:
cvssV2- the CVSS V2 scoring information
-
getCvssV3
public io.github.jeremylong.openvulnerability.client.nvd.CvssV3 getCvssV3()Get the CVSS V3 scoring information.- Returns:
- the CVSS V3 scoring information
-
setCvssV3
public void setCvssV3(io.github.jeremylong.openvulnerability.client.nvd.CvssV3 cvssV3) Sets the CVSS V3 scoring information.- Parameters:
cvssV3- the CVSS V3 scoring information
-
getCvssV4
public io.github.jeremylong.openvulnerability.client.nvd.CvssV4 getCvssV4()Get the CVSS V3 scoring information.- Returns:
- the CVSS V3 scoring information
-
setCvssV4
public void setCvssV4(io.github.jeremylong.openvulnerability.client.nvd.CvssV4 cvssV4) Sets the CVSS V4 scoring information.- Parameters:
cvssV4- the CVSS V4 scoring information
-
getCwes
-
addCwe
-
getUnscoredSeverity
Retrieves the severity aVulnerability.Sourcehas assigned for which a CVSS score is not available. Severity could be anything ranging from 'critical', 'high', 'medium', and 'low', to non-traditional labels like 'major', 'minor', and 'important'.- Returns:
- the un-scored severity
-
setUnscoredSeverity
Sets the severity aVulnerability.Sourcehas assigned for which a CVSS score is not available. Severity could be anything ranging from 'critical', 'high', 'medium', and 'low', to non-traditional labels like 'major', 'minor', and 'important'.- Parameters:
unscoredSeverity- the un-scored severity
-
getNotes
-
setNotes
-
equals
-
hashCode
-
toString
-
compareTo
Compares two vulnerabilities.
Natural order of vulnerabilities is defined as decreasing in severity and alphabetically by name for equal severity. This way the most severe issues are listed first in a sorted list.
This uses abest-effort orderingfor severity as the variety of sources do not guarantee a consistent availability of standardized severity scores. The bestEffort severity level estimation will use CVSSv3 baseScore for comparison when available on both sides. If any of the vulnerabilities does not have a CVSSv3 score the sort order may be off, but it will be consistent.
The ranking (high to low) of severity can be informally represented as<CVSSv3 critical> >> <Unscored recognized critical> >> <Unscored unrecognized (assumed Critical)> >> <Score-based comparison for high-or-lower scoring severities with recognized unscored severities taking the lower bound of the comparable CVSSv3 range>- Specified by:
compareToin interfaceComparable<Vulnerability>- Parameters:
o- a vulnerability to be compared- Returns:
- a negative integer, zero, or a positive integer as this object is less than , equal to, or greater than the specified vulnerability
- See Also:
-
getHighestSeverityText
The report text to use for highest severity when this issue is ranked highest.- Returns:
- The string to display in the report, clarifying for unrecognized unscored severities that critical is assumed.
-
setMatchedVulnerableSoftware
Sets the CPE that caused this vulnerability to be flagged.- Parameters:
software- a Vulnerable Software identifier
-
getMatchedVulnerableSoftware
Get the value of matchedVulnerableSoftware.- Returns:
- the value of matchedVulnerableSoftware
-
getSource
Returns the source that identified the vulnerability.- Returns:
- the source
-
setSource
Sets the source that identified the vulnerability.- Parameters:
source- the source
-