Class: SvgSentinel::Finding

Inherits:
Struct
  • Object
show all
Defined in:
lib/svg_sentinel/finding.rb

Overview

One thing the scanner noticed.

Two orthogonal axes describe a finding:

  • severity - :critical (unsafe to render or embed as-is) or :warning (worth a second look, but not on its own a reason to reject).
  • category - :security (an actual attack surface: scripts, XXE, script URIs, external references) or :policy (a brand-mark / strict-profile house rule such as animation, raster images, or size).

safe? keys off severity; the category lets a caller separate genuine security signals from profile-compliance noise.

path is the slash-joined element path where the finding occurred (e.g. "svg/g/script"), or nil for document-level findings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def category
  @category
end

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def code
  @code
end

#detailObject

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def detail
  @detail
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def message
  @message
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def path
  @path
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



19
20
21
# File 'lib/svg_sentinel/finding.rb', line 19

def severity
  @severity
end

Instance Method Details

#critical?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/svg_sentinel/finding.rb', line 20

def critical?
  severity == :critical
end

#policy?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/svg_sentinel/finding.rb', line 32

def policy?
  category == :policy
end

#security?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/svg_sentinel/finding.rb', line 28

def security?
  category == :security
end

#to_hObject



36
37
38
# File 'lib/svg_sentinel/finding.rb', line 36

def to_h
  {code: code, severity: severity, category: category, message: message, detail: detail, path: path}
end

#warning?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/svg_sentinel/finding.rb', line 24

def warning?
  severity == :warning
end