19 lines
719 B
Python
19 lines
719 B
Python
from ._source import load_symbols
|
|
|
|
|
|
def _namespace():
|
|
return load_symbols("_AUDIT_SENSITIVE_KEYS", "_redact_audit_value", "safe_audit_detail", globals_dict={"json": __import__("json")})
|
|
|
|
|
|
def test_structured_audit_detail_redacts_secret_categories():
|
|
safe = _namespace()["safe_audit_detail"]({"license_key": "abc", "result": "valid", "nested": {"token": "xyz"}})
|
|
assert "abc" not in safe and "xyz" not in safe
|
|
assert safe.count("[REDACTED]") == 2
|
|
assert "valid" in safe
|
|
|
|
|
|
def test_text_audit_detail_redacts_key_value_pairs():
|
|
safe = _namespace()["safe_audit_detail"]("license_key=abc token:xyz outcome=valid")
|
|
assert "abc" not in safe and "xyz" not in safe
|
|
assert "outcome=valid" in safe
|