Class: SeccompTools::Audit::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/seccomp-tools/audit/finding.rb

Overview

One weakness reported by a Check: a stable id, a severity, a human +title+/+detail+, the architecture it applies to, the syscalls involved, an optional argument condition under which it holds, and a one-line remediation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#archObject

Returns the value of attribute arch

Returns:

  • (Object)

    the current value of arch



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def arch
  @arch
end

#conditionObject

Returns the value of attribute condition

Returns:

  • (Object)

    the current value of condition



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def condition
  @condition
end

#detailObject

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def detail
  @detail
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def id
  @id
end

#remediationObject

Returns the value of attribute remediation

Returns:

  • (Object)

    the current value of remediation



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def remediation
  @remediation
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def severity
  @severity
end

#syscallsObject

Returns the value of attribute syscalls

Returns:

  • (Object)

    the current value of syscalls



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def syscalls
  @syscalls
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



11
12
13
# File 'lib/seccomp-tools/audit/finding.rb', line 11

def title
  @title
end

Instance Method Details

#rankArray

Sort key: by severity, then id, then the affected syscalls.

Returns:

  • (Array)


15
16
17
# File 'lib/seccomp-tools/audit/finding.rb', line 15

def rank
  [SEVERITIES.index(severity) || SEVERITIES.size, id, Array(syscalls).join(',')]
end

#to_hHash

Returns JSON-ready shape.

Returns:

  • (Hash)

    JSON-ready shape.



20
21
22
# File 'lib/seccomp-tools/audit/finding.rb', line 20

def to_h
  { id:, severity:, title:, detail:, arch:, syscalls: Array(syscalls), condition:, remediation: }
end