Class SuppressionRule

java.lang.Object
org.owasp.dependencycheck.xml.suppression.SuppressionRule

@NotThreadSafe public class SuppressionRule extends Object
Author:
Jeremy Long
  • Constructor Details

    • SuppressionRule

      public SuppressionRule()
  • Method Details

    • isMatched

      public boolean isMatched()
      Get the value of matched.
      Returns:
      the value of matched
    • setMatched

      public void setMatched(boolean matched)
      Set the value of matched.
      Parameters:
      matched - new value of matched
    • getUntil

      public Calendar getUntil()
      Get the (@code{nullable}) value of until.
      Returns:
      the value of until
    • setUntil

      public void setUntil(Calendar until)
      Set the value of until.
      Parameters:
      until - new value of until
    • getFilePath

      public PropertyType getFilePath()
      Get the value of filePath.
      Returns:
      the value of filePath
    • setFilePath

      public void setFilePath(PropertyType filePath)
      Set the value of filePath.
      Parameters:
      filePath - new value of filePath
    • getSha1

      public String getSha1()
      Get the value of sha1.
      Returns:
      the value of sha1
    • setSha1

      public void setSha1(String sha1)
      Set the value of SHA1.
      Parameters:
      sha1 - new value of SHA1
    • getCpe

      public List<PropertyType> getCpe()
      Get the value of CPE.
      Returns:
      the value of CPE
    • setCpe

      public void setCpe(List<PropertyType> cpe)
      Set the value of CPE.
      Parameters:
      cpe - new value of CPE
    • addCpe

      public void addCpe(PropertyType cpe)
      Adds the CPE to the CPE list.
      Parameters:
      cpe - the CPE to add
    • addVulnerabilityName

      public void addVulnerabilityName(PropertyType name)
      Adds the CPE to the CPE list.
      Parameters:
      name - the vulnerability name to add
    • hasCpe

      public boolean hasCpe()
      Returns whether or not this suppression rule as CPE entries.
      Returns:
      whether or not this suppression rule as CPE entries
    • getCvssBelow

      public List<Double> getCvssBelow()
      Get the value of cvssBelow.
      Returns:
      the value of cvssBelow
    • setCvssBelow

      public void setCvssBelow(List<Double> cvssBelow)
      Set the value of cvssBelow.
      Parameters:
      cvssBelow - new value of cvssBelow
    • addCvssBelow

      public void addCvssBelow(Double cvss)
      Adds the CVSS to the cvssBelow list.
      Parameters:
      cvss - the CVSS to add
    • hasCvssBelow

      public boolean hasCvssBelow()
      Returns whether or not this suppression rule has CVSS suppression criteria.
      Returns:
      whether or not this suppression rule has CVSS suppression criteria.
    • getCvssV2Below

      public List<Double> getCvssV2Below()
      Get the value of cvssV2Below.
      Returns:
      the value of cvssV2Below
    • setCvssV2Below

      public void setCvssV2Below(List<Double> cvssV2Below)
      Set the value of cvssV2Below.
      Parameters:
      cvssV2Below - new value of cvssV2Below
    • addCvssV2Below

      public void addCvssV2Below(Double cvss)
      Adds the CVSS to the cvssV2Below list.
      Parameters:
      cvss - the CVSS to add
    • hasCvssV2Below

      public boolean hasCvssV2Below()
      Returns whether or not this suppression rule has CVSS v2 suppression criteria.
      Returns:
      whether or not this suppression rule has CVSS v2 suppression criteria.
    • getCvssV3Below

      public List<Double> getCvssV3Below()
      Get the value of cvssV3Below.
      Returns:
      the value of cvssV3Below
    • setCvssV3Below

      public void setCvssV3Below(List<Double> cvssV3Below)
      Set the value of cvssV3Below.
      Parameters:
      cvssV3Below - new value of cvssV3Below
    • addCvssV3Below

      public void addCvssV3Below(Double cvss)
      Adds the CVSS to the cvssV3Below list.
      Parameters:
      cvss - the CVSS to add
    • hasCvssV3Below

      public boolean hasCvssV3Below()
      Returns whether or not this suppression rule has CVSS v3 suppression criteria.
      Returns:
      whether or not this suppression rule has CVSS v3 suppression criteria.
    • getCvssV4Below

      public List<Double> getCvssV4Below()
      Get the value of cvssV4Below.
      Returns:
      the value of cvssV4Below
    • setCvssV4Below

      public void setCvssV4Below(List<Double> cvssV4Below)
      Set the value of cvssV4Below.
      Parameters:
      cvssV4Below - new value of cvssV4Below
    • addCvssV4Below

      public void addCvssV4Below(Double cvss)
      Adds the CVSS to the cvssV4Below list.
      Parameters:
      cvss - the CVSS to add
    • hasCvssV4Below

      public boolean hasCvssV4Below()
      Returns whether or not this suppression rule has CVSS v4 suppression criteria.
      Returns:
      whether or not this suppression rule has CVSS v4 suppression criteria.
    • getNotes

      public String getNotes()
      Get the value of notes.
      Returns:
      the value of notes
    • setNotes

      public void setNotes(String notes)
      Set the value of notes.
      Parameters:
      notes - new value of notes
    • hasNotes

      public boolean hasNotes()
      Returns whether this suppression rule has notes entries.
      Returns:
      whether this suppression rule has notes entries
    • getCwe

      public List<String> getCwe()
      Get the value of CWE.
      Returns:
      the value of CWE
    • setCwe

      public void setCwe(List<String> cwe)
      Set the value of CWE.
      Parameters:
      cwe - new value of CWE
    • addCwe

      public void addCwe(String cwe)
      Adds the CWE to the CWE list.
      Parameters:
      cwe - the CWE to add
    • hasCwe

      public boolean hasCwe()
      Returns whether this suppression rule has CWE entries.
      Returns:
      whether this suppression rule has CWE entries
    • getCve

      public List<String> getCve()
      Get the value of CVE.
      Returns:
      the value of CVE
    • setCve

      public void setCve(List<String> cve)
      Set the value of CVE.
      Parameters:
      cve - new value of CVE
    • addCve

      public void addCve(String cve)
      Adds the CVE to the CVE list.
      Parameters:
      cve - the CVE to add
    • hasCve

      public boolean hasCve()
      Returns whether this suppression rule has CVE entries.
      Returns:
      whether this suppression rule has CVE entries
    • hasVulnerabilityName

      public boolean hasVulnerabilityName()
      Returns whether this suppression rule has vulnerabilityName entries.
      Returns:
      whether this suppression rule has vulnerabilityName entries
    • getGav

      public PropertyType getGav()
      Get the value of Maven GAV.
      Returns:
      the value of GAV
    • setGav

      public void setGav(PropertyType gav)
      Set the value of Maven GAV.
      Parameters:
      gav - new value of Maven GAV
    • hasGav

      public boolean hasGav()
      Returns whether or not this suppression rule as GAV entries.
      Returns:
      whether or not this suppression rule as GAV entries
    • setPackageUrl

      public void setPackageUrl(PropertyType purl)
      Set the value of Package URL.
      Parameters:
      purl - new value of package URL
    • hasPackageUrl

      public boolean hasPackageUrl()
      Returns whether or not this suppression rule as packageUrl entries.
      Returns:
      whether or not this suppression rule as packageUrl entries
    • isBase

      public boolean isBase()
      Get the value of base.
      Returns:
      the value of base
    • setBase

      public void setBase(boolean base)
      Set the value of base.
      Parameters:
      base - new value of base
    • process

      public void process(Dependency dependency)
      Processes a given dependency to determine if any CPE, CVE, CWE, or CVSS scores should be suppressed. If any should be, they are removed from the dependency.
      Parameters:
      dependency - a project dependency to analyze
    • cpeHasNoVersion

      protected boolean cpeHasNoVersion(PropertyType c)
      Identifies if the cpe specified by the cpe suppression rule does not specify a version.
      Parameters:
      c - a suppression rule identifier
      Returns:
      true if the property type does not specify a version; otherwise false
    • purlMatches

      protected boolean purlMatches(PropertyType suppressionEntry, Identifier identifier)
      Determines if the cpeEntry specified as a PropertyType matches the given Identifier.
      Parameters:
      suppressionEntry - a suppression rule entry
      identifier - a CPE identifier to check
      Returns:
      true if the entry matches; otherwise false
    • identifierMatches

      protected boolean identifierMatches(PropertyType suppressionEntry, Identifier identifier)
      Determines if the cpeEntry specified as a PropertyType matches the given Identifier.
      Parameters:
      suppressionEntry - a suppression rule entry
      identifier - a CPE identifier to check
      Returns:
      true if the entry matches; otherwise false
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object
    • equals

      public boolean equals(Object o)
      Suppression rules are considered equal if all properties except the "notes" and mutual "matched" status are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - the reference object with which to compare.
      Returns:
      whether the object is equals to this one
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object