MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / redact_sensitive

Function redact_sensitive

IntelOSINT.py:2111–2126  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

2109
2110
2111def redact_sensitive(value):
2112 if isinstance(value, dict):
2113 out = {}
2114 for k, v in value.items():
2115 lk = str(k).lower()
2116 if any(n in lk for n in SENSITIVE_FIELD_NEEDLES):
2117 out[k] = "[REDACTED]"
2118 else:
2119 out[k] = redact_sensitive(v)
2120 return out
2121 if isinstance(value, list):
2122 return [redact_sensitive(v) for v in value]
2123 if isinstance(value, str):
2124 if re.search(r"(sessionid|api[_ -]?hash|authorization|bearer|token|password|cookie)", value, re.I):
2125 return "[REDACTED]"
2126 return value
2127
2128
2129def safe_json_dump(payload, fp, **kwargs):

Callers 2

safe_json_dumpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected