Skip to content

fix(security): decouple request PII redaction from injection mode - #8102

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/sanitizer-correctness-docs
Jul 22, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/sanitizer-correctness-docs

Conversation

@RaviTharuma

Copy link
Copy Markdown
Contributor

Summary

Fixes the sanitizer/guardrail config footgun where request PII redaction required INPUT_SANITIZER_MODE=redact, which made the documented enterprise recipe (MODE=block + PII_REDACTION_ENABLED=true) detect PII but still forward it upstream.

Also closes related docs/coverage gaps from the sanitizer audit.

Closes #8092
Closes #8094
Related: #8093, #8095, #8096, #8097

Changes

Code

  • pii-masker preCall: PII_REDACTION_ENABLED=true now redacts request PII independently of injection mode
  • Request shape coverage: redacts Responses API plain-string input[] items, top-level string input, and prompt
  • sanitizeRequest / redactBody: same independent PII rewrite + broader body walk (string messages/system/input/prompt)

Docs

  • Stop claiming INPUT_SANITIZER_MODE=redact strips injection patterns
  • Document that request PII rewrite is controlled only by PII_REDACTION_ENABLED
  • Clarify enterprise recipe so block + PII redaction are independent

Tests

  • Registry test: redaction works with MODE=block
  • Registry test: Responses string input / top-level string input
  • New input-sanitizer-pii-redaction.test.ts matrix

Test plan

  • node --import tsx/esm ... --test tests/unit/input-sanitizer-pii-redaction.test.ts (3/3 pass)
  • node --import tsx/esm ... --test tests/unit/guardrails-registry.test.ts (7/7 pass)
  • CI unit suite on this PR

Notes / intentional non-goals in this PR

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@RaviTharuma

Copy link
Copy Markdown
Contributor Author

Superseded by #8124 which includes the PII decoupling work plus residual threshold/default alignment, docs/env contract sync, and the critical tar audit unblock.

Recommend closing this PR in favor of #8124.

PII_REDACTION_ENABLED now rewrites request PII independently of
INPUT_SANITIZER_MODE, so the enterprise recipe (MODE=block + PII on)
actually redacts. Also cover Responses API string input/prompt shapes
and correct docs that claimed MODE=redact strips injection text.

Refs: #8092 #8093 #8094 #8096 #8097
Unblocks CI lint/quality ratchet on the PII redaction PR by typing
chat-like payloads instead of casting to any.
@diegosouzapw
diegosouzapw force-pushed the fix/sanitizer-correctness-docs branch from dc26102 to c78885b Compare July 22, 2026 20:25
@diegosouzapw
diegosouzapw merged commit 7ae1716 into cheaper-inference:release/v3.8.49 Jul 22, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Obrigado, @RaviTharuma — mergeado na release/v3.8.49. Validado no tip combinado (merge-train: typecheck + file-size + 106 testes das áreas tocadas + vitest 271/271 verdes). O único red de CI era o base-red compartilhado de complexity (pré-existente na tip da release, não deste PR).

@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…eaper-inference#8102)

* fix(security): decouple request PII redaction from injection mode

PII_REDACTION_ENABLED now rewrites request PII independently of
INPUT_SANITIZER_MODE, so the enterprise recipe (MODE=block + PII on)
actually redacts. Also cover Responses API string input/prompt shapes
and correct docs that claimed MODE=redact strips injection text.

Refs: cheaper-inference#8092 cheaper-inference#8093 cheaper-inference#8094 cheaper-inference#8096 cheaper-inference#8097

* test(security): drop no-explicit-any in sanitizer unit tests

Unblocks CI lint/quality ratchet on the PII redaction PR by typing
chat-like payloads instead of casting to any.

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
@RaviTharuma
RaviTharuma deleted the fix/sanitizer-correctness-docs branch September 23, 2026 19:38
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…eaper-inference#8102)

* fix(security): decouple request PII redaction from injection mode

PII_REDACTION_ENABLED now rewrites request PII independently of
INPUT_SANITIZER_MODE, so the enterprise recipe (MODE=block + PII on)
actually redacts. Also cover Responses API string input/prompt shapes
and correct docs that claimed MODE=redact strips injection text.

Refs: cheaper-inference#8092 cheaper-inference#8093 cheaper-inference#8094 cheaper-inference#8096 cheaper-inference#8097

* test(security): drop no-explicit-any in sanitizer unit tests

Unblocks CI lint/quality ratchet on the PII redaction PR by typing
chat-like payloads instead of casting to any.

---------

Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants