Skip to content

Add sanitize_obj helper for redacting sensitive data - #21

Draft
binrogithub wants to merge 1 commit into
masterfrom
codex/create-sanitize.py-with-sanitize_obj-function
Draft

Add sanitize_obj helper for redacting sensitive data#21
binrogithub wants to merge 1 commit into
masterfrom
codex/create-sanitize.py-with-sanitize_obj-function

Conversation

@binrogithub

Copy link
Copy Markdown
Owner

Motivation

  • Provide a reusable utility to remove or mask sensitive values (tokens, secrets, certs, kubeconfigs) from arbitrary data structures.
  • Handle very large strings and binary blobs by replacing them with a deterministic hashed redaction marker while preserving data shape for logging and diagnostics.

Description

  • Add hc_agent/core/sanitize.py implementing sanitize_obj() and helpers for key detection and redaction.
  • Detect sensitive keys using case-insensitive substring matching against ("token","secret","cert","kubeconfig").
  • Replace large strings and bytes with <redacted sha256=... len=...> markers computed via hashlib.sha256, while leaving small values intact.
  • Recursively sanitize nested structures and common container types (dict, list, tuple, set) to preserve structure.

Testing

  • No automated tests were run for this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant