Class: Raven::Processor::SanitizeData
- Inherits:
-
Raven::Processor
- Object
- Raven::Processor
- Raven::Processor::SanitizeData
- Defined in:
- lib/raven/processor/sanitizedata.rb
Constant Summary collapse
- STRING_MASK =
'********'
- INT_MASK =
0
- FIELDS_RE =
/(authorization|password|passwd|secret|ssn|social(.*)?sec)/i
- VALUES_RE =
/^\d{16}$/
Instance Method Summary collapse
Methods inherited from Raven::Processor
Constructor Details
This class inherits a constructor from Raven::Processor
Instance Method Details
#process(value) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/raven/processor/sanitizedata.rb', line 8 def process(value) value.inject(value) do |value,(k,v)| v = k if v.nil? if v.is_a?(Hash) || v.is_a?(Array) process(v) elsif v.is_a?(String) && (json = parse_json_or_nil(v)) #if this string is actually a json obj, convert and sanitize value = modify_in_place(value, [k,v], process(json).to_json) elsif v.is_a?(Integer) && (VALUES_RE.match(v.to_s) || FIELDS_RE.match(k.to_s)) value = modify_in_place(value, [k,v], INT_MASK) elsif VALUES_RE.match(v.to_s) || FIELDS_RE.match(k.to_s) value = modify_in_place(value, [k,v], STRING_MASK) else value end end value end |