Module: Enums::Vulnerability
- Defined in:
- app/models/concerns/enums/vulnerability.rb
Constant Summary collapse
- CONFIDENCE_LEVELS =
{ # undefined: 0, no longer applicable ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 }.with_indifferent_access.freeze
- REPORT_TYPES =
{ sast: 0, secret_detection: 4 }.with_indifferent_access.freeze
- SEVERITY_LEVELS =
{ # undefined: 0, no longer applicable info: 1, unknown: 2, # experimental: 3, formerly used by confidence, no longer applicable low: 4, medium: 5, high: 6, critical: 7 }.with_indifferent_access.freeze
- DETECTION_METHODS =
{ gitlab_security_report: 0, external_security_report: 1, bug_bounty: 2, code_review: 3, security_audit: 4 }.with_indifferent_access.freeze
- VULNERABILITY_STATES =
keep the order of the values in the state enum, it is used in state_order method to properly order vulnerabilities based on state remember to recreate index_vulnerabilities_on_state_case_id index when you update or extend this enum
{ detected: 1, confirmed: 4, resolved: 3, dismissed: 2 }.with_indifferent_access.freeze
Class Method Summary collapse
- .confidence_levels ⇒ Object
- .detection_methods ⇒ Object
- .parse_confidence_level(input) ⇒ Object
- .parse_severity_level(input) ⇒ Object
- .report_types ⇒ Object
- .severity_levels ⇒ Object
- .vulnerability_states ⇒ Object
Class Method Details
.confidence_levels ⇒ Object
49 50 51 |
# File 'app/models/concerns/enums/vulnerability.rb', line 49 def self.confidence_levels CONFIDENCE_LEVELS end |
.detection_methods ⇒ Object
69 70 71 |
# File 'app/models/concerns/enums/vulnerability.rb', line 69 def self.detection_methods DETECTION_METHODS end |
.parse_confidence_level(input) ⇒ Object
53 54 55 |
# File 'app/models/concerns/enums/vulnerability.rb', line 53 def self.parse_confidence_level(input) input&.downcase.then { |value| confidence_levels.key?(value) ? value : 'unknown' } end |
.parse_severity_level(input) ⇒ Object
65 66 67 |
# File 'app/models/concerns/enums/vulnerability.rb', line 65 def self.parse_severity_level(input) input&.downcase.then { |value| severity_levels.key?(value) ? value : 'unknown' } end |
.report_types ⇒ Object
57 58 59 |
# File 'app/models/concerns/enums/vulnerability.rb', line 57 def self.report_types REPORT_TYPES end |
.severity_levels ⇒ Object
61 62 63 |
# File 'app/models/concerns/enums/vulnerability.rb', line 61 def self.severity_levels SEVERITY_LEVELS end |
.vulnerability_states ⇒ Object
73 74 75 |
# File 'app/models/concerns/enums/vulnerability.rb', line 73 def self.vulnerability_states VULNERABILITY_STATES end |