Skip to content

fix(gateway): PII redaction config never read — missing yaml import#1701

Merged
teknium1 merged 1 commit intomainfrom
fix/gateway-yaml-pii-redaction
Mar 17, 2026
Merged

fix(gateway): PII redaction config never read — missing yaml import#1701
teknium1 merged 1 commit intomainfrom
fix/gateway-yaml-pii-redaction

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

The privacy.redact_pii config reader in gateway/run.py line 1546 used bare yaml.safe_load(), but yaml is not in scope at that point — the module-level import is import yaml as _yaml (line 93), and other methods use local import yaml as _y.

The NameError was silently caught by the try/except Exception: pass block, so _redact_pii always defaulted to False. Users who configured privacy.redact_pii: true got no PII redaction in the gateway.

What changed

  • gateway/run.py: Added local import yaml as _pii_yaml before the safe_load call, consistent with the aliased-import pattern used throughout the file.

Test plan

  • Set privacy.redact_pii: true in config.yaml
  • Send a message via gateway containing PII
  • Verify redaction is applied (previously: always skipped)
The privacy.redact_pii config reader on line 1546 used bare 'yaml'
which is not in scope — yaml is imported as '_yaml' at module level
(line 93) and as '_y' in other methods. The NameError was silently
caught by the try/except, so PII redaction never activated even when
configured.

Add a local 'import yaml as _pii_yaml' consistent with the pattern
used elsewhere in the file.
@teknium1 teknium1 merged commit 1781c05 into main Mar 17, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant