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.
186 187 188 189 190 191 192 193 194 |
# File 'vulns/match.rb', line 186 def initialize(vulnerability:, evidence:) raise ArgumentError, "Hit requires at least one Evidence" if evidence.empty? @vulnerability = vulnerability resolved_evidence = evidence.map { |e| e.with_source(vulnerability) } .sort_by { |e| -STRATEGY_PRECISION.fetch(e.strategy) } .freeze @evidence = T.let(resolved_evidence, 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.
183 184 185 |
# File 'vulns/match.rb', line 183 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.
180 181 182 |
# File 'vulns/match.rb', line 180 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.
212 213 214 |
# File 'vulns/match.rb', line 212 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.
217 218 219 |
# File 'vulns/match.rb', line 217 def identifiers (vulnerability.identifiers + evidence.flat_map { |item| item.source_record&.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.
197 198 199 |
# File 'vulns/match.rb', line 197 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.
207 208 209 |
# File 'vulns/match.rb', line 207 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.
202 203 204 |
# File 'vulns/match.rb', line 202 def strategy primary_evidence.strategy end |