Class: CISA::KEV::Vulnerability
- Inherits:
-
Object
- Object
- CISA::KEV::Vulnerability
- Defined in:
- lib/cisa/kev/vulnerability.rb
Overview
Represents a parsed vulnerability in the CISA KEV catalog.
Instance Attribute Summary collapse
-
#cve_id ⇒ String
(also: #cve)
readonly
The CVE ID of the vulnerability.
-
#date_added ⇒ Date
readonly
The date the vulnerability was added to the CISA KEV catalog.
-
#due_date ⇒ Date
readonly
The due date.
-
#known_ransomware_campaign_use ⇒ Boolean
(also: #known_ransomware_campaign_use?)
readonly
Whether the vulnerability is currently being used in ransomware campaigns.
-
#notes ⇒ String?
readonly
Any additional notes for the vulnerability.
-
#product ⇒ String
readonly
The vendor's product.
-
#required_action ⇒ String
readonly
The required action to resolve the vulnerability.
-
#short_description ⇒ String
(also: #description)
readonly
A short description of the vulnerability.
-
#vendor_project ⇒ String
readonly
The vendor project.
-
#vulnerability_name ⇒ String
(also: #name)
readonly
The vulnerability name or title.
Class Method Summary collapse
-
.from_json(json) ⇒ Vulnerability
private
Loads the vulnerability from a parsed JSON hash.
Instance Method Summary collapse
-
#initialize(cve_id:, vendor_project:, product:, vulnerability_name:, date_added:, short_description:, required_action:, due_date:, known_ransomware_campaign_use: false, notes: nil) ⇒ Vulnerability
constructor
private
Initializes the vulnerability.
-
#to_s ⇒ String
Converts the vulnerability to a String.
Constructor Details
#initialize(cve_id:, vendor_project:, product:, vulnerability_name:, date_added:, short_description:, required_action:, due_date:, known_ransomware_campaign_use: false, notes: nil) ⇒ Vulnerability
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the vulnerability.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/cisa/kev/vulnerability.rb', line 105 def initialize(cve_id: , vendor_project: , product: , vulnerability_name: , date_added: , short_description: , required_action: , due_date: , known_ransomware_campaign_use: false, notes: nil) @cve_id = cve_id @vendor_project = vendor_project @product = product @vulnerability_name = vulnerability_name @date_added = date_added @short_description = short_description @required_action = required_action @due_date = due_date @known_ransomware_campaign_use = known_ransomware_campaign_use @notes = notes end |
Instance Attribute Details
#cve_id ⇒ String (readonly) Also known as: cve
The CVE ID of the vulnerability.
17 18 19 |
# File 'lib/cisa/kev/vulnerability.rb', line 17 def cve_id @cve_id end |
#date_added ⇒ Date (readonly)
The date the vulnerability was added to the CISA KEV catalog.
39 40 41 |
# File 'lib/cisa/kev/vulnerability.rb', line 39 def date_added @date_added end |
#due_date ⇒ Date (readonly)
The due date.
55 56 57 |
# File 'lib/cisa/kev/vulnerability.rb', line 55 def due_date @due_date end |
#known_ransomware_campaign_use ⇒ Boolean (readonly) Also known as: known_ransomware_campaign_use?
Whether the vulnerability is currently being used in ransomware campaigns.
61 62 63 |
# File 'lib/cisa/kev/vulnerability.rb', line 61 def known_ransomware_campaign_use @known_ransomware_campaign_use end |
#notes ⇒ String? (readonly)
Any additional notes for the vulnerability.
67 68 69 |
# File 'lib/cisa/kev/vulnerability.rb', line 67 def notes @notes end |
#product ⇒ String (readonly)
The vendor's product.
28 29 30 |
# File 'lib/cisa/kev/vulnerability.rb', line 28 def product @product end |
#required_action ⇒ String (readonly)
The required action to resolve the vulnerability.
50 51 52 |
# File 'lib/cisa/kev/vulnerability.rb', line 50 def required_action @required_action end |
#short_description ⇒ String (readonly) Also known as: description
A short description of the vulnerability.
44 45 46 |
# File 'lib/cisa/kev/vulnerability.rb', line 44 def short_description @short_description end |
#vendor_project ⇒ String (readonly)
The vendor project.
23 24 25 |
# File 'lib/cisa/kev/vulnerability.rb', line 23 def vendor_project @vendor_project end |
#vulnerability_name ⇒ String (readonly) Also known as: name
The vulnerability name or title.
33 34 35 |
# File 'lib/cisa/kev/vulnerability.rb', line 33 def vulnerability_name @vulnerability_name end |
Class Method Details
.from_json(json) ⇒ Vulnerability
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the vulnerability from a parsed JSON hash.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/cisa/kev/vulnerability.rb', line 138 def self.from_json(json) new( cve_id: json.fetch('cveID'), vendor_project: json.fetch('vendorProject'), product: json.fetch('product'), vulnerability_name: json.fetch('vulnerabilityName'), date_added: Date.parse(json.fetch('dateAdded')), short_description: json.fetch('shortDescription'), required_action: json.fetch('requiredAction'), due_date: Date.parse(json.fetch('dueDate')), known_ransomware_campaign_use: (json['knownRansomwareCampaignUse'] == 'Known'), notes: if (notes = json['notes']) && !notes.empty? notes end ) end |
Instance Method Details
#to_s ⇒ String
Converts the vulnerability to a String.
162 163 164 |
# File 'lib/cisa/kev/vulnerability.rb', line 162 def to_s @vulnerability_name end |