extended_data.primitives.redaction

Tier 1 redaction helpers for diagnostics and JSON-like data.

Module Contents

Functions

_redacted_value

Return a redacted placeholder while preserving matching quotes.

_redacted_field

Return a redacted key/value field while preserving JSON shape.

_iter_known_values

Yield scalar known-sensitive values from nested caller context.

_slash_encoding_variants

Return common variants where any slash positions are URL encoded.

_redact_known_values

Redact explicitly provided values and URL-encoded variants.

redact_sensitive_text

Redact common secret fields in terminal-oriented text.

redact_sensitive_data

Recursively redact common secret fields in JSON-like data.

Data

API

extended_data.primitives.redaction.SENSITIVE_KEY_PATTERN = 'api[_-]?key|access[_-]?token|refresh[_-]?token|id[_-]?token|token|secret|password|passwd|pwd|authori...'
extended_data.primitives.redaction.SENSITIVE_KEY_RE = 'compile(...)'
extended_data.primitives.redaction.JSON_SECRET_RE = 'compile(...)'
extended_data.primitives.redaction.KEY_VALUE_SECRET_RE = 'compile(...)'
extended_data.primitives.redaction.CLI_SECRET_RE = 'compile(...)'
extended_data.primitives.redaction.BEARER_SECRET_RE = 'compile(...)'
extended_data.primitives.redaction.REDACTED = '[REDACTED]'
extended_data.primitives.redaction._redacted_value(value: str) str

Return a redacted placeholder while preserving matching quotes.

extended_data.primitives.redaction._redacted_field(match: re.Match[str]) str

Return a redacted key/value field while preserving JSON shape.

extended_data.primitives.redaction._iter_known_values(values: collections.abc.Iterable[Any]) collections.abc.Iterable[Any]

Yield scalar known-sensitive values from nested caller context.

extended_data.primitives.redaction._slash_encoding_variants(value: str) set[str]

Return common variants where any slash positions are URL encoded.

extended_data.primitives.redaction._redact_known_values(text: str, values: collections.abc.Iterable[Any] | None) str

Redact explicitly provided values and URL-encoded variants.

extended_data.primitives.redaction.redact_sensitive_text(message: Any, *, values: collections.abc.Iterable[Any] | None = None) str

Redact common secret fields in terminal-oriented text.

extended_data.primitives.redaction.redact_sensitive_data(value: Any, *, values: collections.abc.Iterable[Any] | None = None) Any

Recursively redact common secret fields in JSON-like data.