Module: ActiveCypher::Redaction
- Defined in:
- lib/active_cypher/redaction.rb
Overview
Shared constants and utilities for redacting sensitive information in inspection output
Constant Summary collapse
- MASK =
The mask to use for sensitive information
'[HUNTER2]'- SENSITIVE_KEYS =
Common sensitive parameter keys
i[password credentials auth_token principal url].freeze
Class Method Summary collapse
-
.create_filter(additional_keys = []) ⇒ ActiveSupport::ParameterFilter
Create a parameter filter with the default mask and keys.
-
.filter_hash(hash, additional_keys = []) ⇒ Hash
Filter a hash to redact sensitive information.
Class Method Details
.create_filter(additional_keys = []) ⇒ ActiveSupport::ParameterFilter
Create a parameter filter with the default mask and keys
15 16 17 18 |
# File 'lib/active_cypher/redaction.rb', line 15 def self.create_filter(additional_keys = []) keys = SENSITIVE_KEYS + additional_keys ActiveSupport::ParameterFilter.new(keys, mask: MASK) end |
.filter_hash(hash, additional_keys = []) ⇒ Hash
Filter a hash to redact sensitive information
24 25 26 |
# File 'lib/active_cypher/redaction.rb', line 24 def self.filter_hash(hash, additional_keys = []) create_filter(additional_keys).filter(hash) end |