scrub_text (observability/redact.py)

opensquilla · src/opensquilla/observability/redact.py · python · Apache-2.0
auth

Redacts sensitive data from text and JSON, preserving structure for diagnostics.

# Source: https://github.com/TokenRhythm/opensquilla | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Structured and text scrubbing for user-shareable diagnostic artifacts.

JSON objects pass through :func:`scrub_json` before serialization to preserve
metadata types and JSON syntax. Free text uses :func:`scrub_text` to mask
credential assignments, headers and recognizable token values.
"""

from __future__ import annotations

import re
from pathlib import Path
from typing import Any

_REDACTED = "[redacted]"

# key=value / key: value / "key": "value" where the key looks secret-shaped.
# Match complete credential suffixes using component or namespace boundaries.
# Prefixes may con

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key