Class: Gitlab::SecretDetection::Core::Finding
- Inherits:
-
Object
- Object
- Gitlab::SecretDetection::Core::Finding
- Defined in:
- lib/gitlab/secret_detection/core/finding.rb
Overview
Finding is a data object representing a secret finding identified within a payload
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#payload_id ⇒ Object
readonly
Returns the value of attribute payload_id.
-
#raw_value ⇒ Object
readonly
Returns the value of attribute raw_value.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json(_options = nil) ⇒ Object
-
#initialize(payload_id, status, line_number = nil, type = nil, description = nil, raw_value: nil) ⇒ Finding
constructor
A new instance of Finding.
-
#inspect ⇒ Object
The default
inspectwould dumpraw_valuein plain text, reachingp, error contexts, and anything holding a Finding (+Response+ included). -
#to_h ⇒ Object
raw_valueis omitted here, and fromstateandinspect, so a secret cannot leak. - #to_json(*args) ⇒ Object
Constructor Details
#initialize(payload_id, status, line_number = nil, type = nil, description = nil, raw_value: nil) ⇒ Finding
Returns a new instance of Finding.
12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 12 def initialize(payload_id, status, line_number = nil, type = nil, description = nil, raw_value: nil) @payload_id = payload_id @status = status @line_number = line_number @type = type @description = description @raw_value = raw_value end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def description @description end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def line_number @line_number end |
#payload_id ⇒ Object (readonly)
Returns the value of attribute payload_id.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def payload_id @payload_id end |
#raw_value ⇒ Object (readonly)
Returns the value of attribute raw_value.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def raw_value @raw_value end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10 def type @type end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 21 def ==(other) self.class == other.class && other.state == state end |
#as_json(_options = nil) ⇒ Object
36 37 38 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 36 def as_json( = nil) to_h end |
#inspect ⇒ Object
The default inspect would dump raw_value in plain text, reaching p, error contexts,
and anything holding a Finding (+Response+ included).
46 47 48 49 50 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 46 def inspect "#<#{self.class.name} payload_id=#{payload_id.inspect} status=#{status.inspect} " \ "line_number=#{line_number.inspect} type=#{type.inspect} " \ "description=#{description.inspect} raw_value=#{raw_value.nil? ? 'nil' : '[FILTERED]'}>" end |
#to_h ⇒ Object
raw_value is omitted here, and from state and inspect, so a secret cannot leak.
26 27 28 29 30 31 32 33 34 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 26 def to_h { payload_id:, status:, line_number:, type:, description: } end |
#to_json(*args) ⇒ Object
40 41 42 |
# File 'lib/gitlab/secret_detection/core/finding.rb', line 40 def to_json(*args) to_h.to_json(*args) end |