Class: Homebrew::Vulns::Match::Hit Private
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Instance Attribute Summary collapse
- #evidence ⇒ Array<Evidence> readonly private
- #vulnerability ⇒ Vulnerability readonly private
Instance Method Summary collapse
- #canonical_id ⇒ String private
- #identifiers ⇒ Array<String> private
- #initialize(vulnerability:, evidence:) ⇒ void constructor private
- #primary_evidence ⇒ Evidence private
- #resource ⇒ String? private
- #strategy ⇒ Symbol private
Constructor Details
#initialize(vulnerability:, evidence:) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
182 183 184 185 186 187 188 189 190 191 |
# File 'vulns/match.rb', line 182 def initialize(vulnerability:, evidence:) raise ArgumentError, "Hit requires at least one Evidence" if evidence.empty? @vulnerability = vulnerability @evidence = T.let( evidence.map { |e| e.with_source(vulnerability) } .sort_by { |e| -STRATEGY_PRECISION.fetch(e.strategy) }.freeze, T::Array[Evidence], ) end |
Instance Attribute Details
#evidence ⇒ Array<Evidence> (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
179 180 181 |
# File 'vulns/match.rb', line 179 def evidence @evidence end |
#vulnerability ⇒ Vulnerability (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
176 177 178 |
# File 'vulns/match.rb', line 176 def vulnerability @vulnerability end |
Instance Method Details
#canonical_id ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
209 210 211 |
# File 'vulns/match.rb', line 209 def canonical_id vulnerability.cve_ids.min || vulnerability.id end |
#identifiers ⇒ Array<String>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
214 215 216 217 218 |
# File 'vulns/match.rb', line 214 def identifiers evidence.flat_map { |item| item.source_record&.identifiers || [] } .prepend(*vulnerability.identifiers) .uniq end |
#primary_evidence ⇒ Evidence
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
194 195 196 |
# File 'vulns/match.rb', line 194 def primary_evidence evidence.fetch(0) end |
#resource ⇒ String?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
204 205 206 |
# File 'vulns/match.rb', line 204 def resource primary_evidence.resource end |
#strategy ⇒ Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
199 200 201 |
# File 'vulns/match.rb', line 199 def strategy primary_evidence.strategy end |