Class: StandardAudit::SensitiveKeysDryRun::Report

Inherits:
Struct
  • Object
show all
Defined in:
lib/standard_audit/sensitive_keys_dry_run.rb

Overview

[rows_scanned] how many audit rows were read [stripped] key path => row count, for keys the candidate rule would redact [kept] key path => row count, for keys it would keep [nested_unfiltered] key path => row count, for nested keys the rule matches but which are NOT redacted because filter_nested_metadata is off. This is the exposure filter_nested_metadata exists to close; empty when nested filtering is enabled.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keptObject

Returns the value of attribute kept

Returns:

  • (Object)

    the current value of kept



30
31
32
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 30

def kept
  @kept
end

#nestedObject

Returns the value of attribute nested

Returns:

  • (Object)

    the current value of nested



30
31
32
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 30

def nested
  @nested
end

#nested_unfilteredObject

Returns the value of attribute nested_unfiltered

Returns:

  • (Object)

    the current value of nested_unfiltered



30
31
32
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 30

def nested_unfiltered
  @nested_unfiltered
end

#rows_scannedObject

Returns the value of attribute rows_scanned

Returns:

  • (Object)

    the current value of rows_scanned



30
31
32
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 30

def rows_scanned
  @rows_scanned
end

#strippedObject

Returns the value of attribute stripped

Returns:

  • (Object)

    the current value of stripped



30
31
32
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 30

def stripped
  @stripped
end

Instance Method Details

#any_stripped?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 31

def any_stripped?
  stripped.any?
end

#to_sObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/standard_audit/sensitive_keys_dry_run.rb', line 35

def to_s
  lines = []
  lines << "Rows scanned: #{rows_scanned}"
  lines << "Nested filtering: #{nested ? 'on' : 'off'}"
  lines << ""

  lines << section("WOULD BE STRIPPED", stripped, "Nothing would be stripped.")
  lines << ""
  lines << section("KEPT", kept, "No metadata keys found.")

  if nested_unfiltered.any?
    lines << ""
    lines << section(
      "MATCHES BUT NOT STRIPPED (nested; set config.filter_nested_metadata = true to redact)",
      nested_unfiltered,
      nil
    )
  end

  lines.join("\n")
end