Class: Gitlab::Ci::Reports::Security::FindingSignature
Constant Summary
VulnerabilityFindingSignatureHelpers::ALGORITHM_TYPES
Instance Attribute Summary collapse
Instance Method Summary
collapse
#algorithm_types, #priority
Constructor Details
Returns a new instance of FindingSignature.
12
13
14
15
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 12
def initialize(params = {})
@algorithm_type = params.dig(:algorithm_type)
@signature_value = params.dig(:signature_value)
end
|
Instance Attribute Details
#algorithm_type ⇒ Object
Returns the value of attribute algorithm_type.
10
11
12
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 10
def algorithm_type
@algorithm_type
end
|
#signature_value ⇒ Object
Returns the value of attribute signature_value.
10
11
12
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 10
def signature_value
@signature_value
end
|
Instance Method Details
#eql?(other) ⇒ Boolean
Also known as:
==
36
37
38
39
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 36
def eql?(other)
other.algorithm_type == algorithm_type &&
other.signature_sha == signature_sha
end
|
#signature_hex ⇒ Object
21
22
23
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 21
def signature_hex
signature_sha.unpack1("H*")
end
|
#signature_sha ⇒ Object
17
18
19
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 17
def signature_sha
Digest::SHA1.digest(signature_value)
end
|
#to_hash ⇒ Object
25
26
27
28
29
30
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 25
def to_hash
{
algorithm_type: algorithm_type,
signature_sha: signature_sha
}
end
|
#valid? ⇒ Boolean
32
33
34
|
# File 'lib/gitlab/ci/reports/security/finding_signature.rb', line 32
def valid?
algorithm_types.key?(algorithm_type)
end
|