Skip to content

Add secret redaction for config structures and logs#296

Merged
JE-Chen merged 1 commit into
devfrom
feat/config-redaction-batch
Jun 21, 2026
Merged

Add secret redaction for config structures and logs#296
JE-Chen merged 1 commit into
devfrom
feat/config-redaction-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Produces a masked copy of config or log text — utils/redaction only blurs screenshots and secrets_scan only detects findings.

  • redact_config(obj, *, mask="***") — deep copy with secret-looking values masked, reusing the secrets_scan detector (key-name patterns, AWS/bearer formats, high-entropy strings); vault refs (${secrets.*}) left intact.
  • redact_secret_text(text, *, mask="***") — masks secret-looking tokens in a free-text log line, preserving surrounding words/whitespace.

Named redact_secret_text to stay distinct from the prompt-injection guardrail.redact_text (facade symbol clash avoided).

Layers

  • Headless core: utils/config_redaction/ (pure stdlib re + secrets_scan, zero PySide6).
  • Facade: redact_config, redact_secret_text + __all__.
  • Executor: AC_redact_config, AC_redact_secret_text.
  • MCP: ac_redact_config, ac_redact_secret_text (read-only).
  • Script Builder: both under Security.
  • Tests: test/unit_test/headless/test_config_redaction_batch.py (9 tests; secret-shaped values built at runtime).
  • Docs: v88_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_config_redaction_batch.py → 9 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

utils/redaction only blurs screenshots and secrets_scan only detects —
neither returned a masked copy safe for logs, reports, or config export.
Add redact_config (deep copy with secret-looking values masked, reusing
the secrets_scan detector) and redact_secret_text (mask secret tokens in a
log line). Named redact_secret_text to stay distinct from the
prompt-injection guardrail.redact_text. Wired through facade, executor
(AC_redact_config / AC_redact_secret_text), MCP, and the Script Builder
with a headless test batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 34 complexity · 0 duplication

Metric Results
Complexity 34
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 793d9f6 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/config-redaction-batch branch June 21, 2026 18:19
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant