providers/sanitize.py

console · backend/ee/integrations/secrets/providers/sanitize.py · python · MIT
auth, Auth / Identity

Python utility that recursively redacts sensitive data from nested structures and strings.

# Source: https://github.com/phasehq/console | License: MIT | Copyright 2026 Phi Security Inc
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

import re
from typing import Any

SENSITIVE_KEY_TOKENS = (
    "key",
    "secret",
    "token",
    "password",
    "passwd",
    "credential",
    "authorization",
    "auth",
)

# Identifier keys that match SENSITIVE_KEY_TOKENS but are safe to keep.
SAFE_KEY_NAMES = frozenset(
    {
        "key_id",
        "api_key_id",
        "key_name",
        "key_digest",
        "key_alias",
        "token_id",
        "deleted_keys",
        "provider_credential_id",
        "user_id",
        "team_id",
        "project_id",
        "agent_id",
        "organization_id",
        "budget_id",
    }
)

_

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

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

Get a free API key