is_secret_key (utils/redact.py)

software-agent-sdk · openhands-sdk/openhands/sdk/utils/redact.py · python · MIT
auth, Auth / Identity

Utility functions to detect and redact secret keys from data and URLs.

# Source: https://github.com/OpenHands/software-agent-sdk | License: MIT | Copyright 2026 OpenHands contributors
# Provided via justclaw.it.com; keep this notice with the code.
"""Utilities for redacting sensitive data from logs and error responses.

This module provides a centralized, unified set of patterns and functions for
detecting and redacting secret-bearing keys in structured data (JSON objects,
headers, URLs, etc.). It's the single source of truth for secret key detection
across the SDK.

Copies / consumers (keep in sync when changing):
  - OpenHands/runtime-api  →  utils/redact.py  (partial copy)
  - All-Hands-AI/OpenHands →  imports directly
"""

import copy
import re
from collections.abc import Mapping
from typing import Any
from urllib.parse import parse_qs, urlencode, urlpars

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

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

Get a free API key