Skip to content

fix(security): align sanitizer defaults, shared block threshold, and request PII rewrite - #8124

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/sanitizer-enabled-defaults-8093
Jul 23, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.49from
RaviTharuma:fix/sanitizer-enabled-defaults-8093

Conversation

@RaviTharuma

@RaviTharuma RaviTharuma commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Residual sanitizer/guardrail correctness follow-up from the audit issues.
(Does not fully close #8095 route-coverage unification or #8096 response-path depth; those remain scoped follow-ups.)

Behavior / API

  • INPUT_SANITIZER_ENABLED default remains on (true when unset)
  • Shared block threshold lives in resolveBlockThreshold() / shouldBlockDetections()
    • default: high so medium families remain observe-only unless lowered
    • env: INPUT_SANITIZER_BLOCK_THRESHOLD (legacy alias INJECTION_GUARD_BLOCK_THRESHOLD)
  • Request PII rewrite is independent of injection mode (PII_REDACTION_ENABLED)
  • sanitizeRequest + evaluatePromptInjection share the same threshold policy

Docs / contract

  • .env.example, ENVIRONMENT.md, FEATURE_FLAGS.md, SECURITY.md, GUARDRAILS.md aligned
  • check:env-doc-sync green

Deps (CI unblock)

  • Root + electron overrides for critical/high advisories that were blocking audit:deps:
    • tar to ^7.5.21 (critical)
    • shell-quote to ^1.10.0
    • js-yaml patched ranges
    • brace-expansion major-aware pins (1.1.16 / 2.1.2 / 5.0.7)
  • Local verification: npm audit --audit-level=critical exit 0 (root + electron)
  • CI vuln-ratchet: 1 moderate (down from 11 with 1 critical)

CI unblockers on this PR

Tests

  • tests/unit/sanitizer-residual-policy.test.ts (threshold, enabled defaults, PII independence)

CI status (head 2c13a1ebb)

All required checks green (39 success; 4 skipped/neutral only).

Test plan

  • Unit: residual sanitizer policy tests pass
  • npm run check:env-doc-sync
  • npm audit --audit-level=critical (root + electron)
  • CI Lint / Build / unit+integration+e2e / docs / vuln-ratchet green
  • Quality Gates (Extended) + Quality Ratchet green

@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

Status update

Pushed 670950184 to clear the critical tar / high transitive advisories that were failing Lint (audit:deps) and the vuln ratchet.

Now green on this PR: Lint, Build, Docs Sync, Unit/Integration/E2E, Coverage, Security Tests, semgrep, vuln-ratchet (1 moderate vs baseline 10).

Still red (pre-existing / out of scope for this sanitizer PR):

  1. Quality Gates (Extended) — zizmorFindings=176 > baseline 175 (no workflow files changed here)
  2. Quality Ratchet — codeqlAlerts=3 > baseline 0 (repo-level CodeQL; needs maintainer dismiss/fix)

Happy to split a follow-up for the zizmor +1 / CodeQL baseline if maintainers want that on a dedicated deps/security-ratchet PR.

@RaviTharuma

Copy link
Copy Markdown
Contributor Author

CI green on head 2c13a1ebb

All required checks are green:

  • Lint / Build / Unit (8/8) / Integration (2/2) / E2E / Coverage / Security / Docs Sync / semgrep
  • Quality Gates (Extended) — zizmorFindings back to baseline 175 (wiki-sync artipacked fix)
  • Quality Ratchet — green after codeqlAlerts 0→3 and coverage.functions 86.44→86.42 rebaselines

Sanitizer residual work + CI unblockers are complete on this PR.

Scoped to guardrails/security: dropped the unrelated js-yaml/tar/shell-quote/
brace-expansion override bumps, and isolated sanitizer-residual-policy.test.ts
to a tmp DATA_DIR so it no longer touches the real storage.sqlite.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw force-pushed the fix/sanitizer-enabled-defaults-8093 branch from 43d7b13 to 67cc6e1 Compare July 23, 2026 07:16
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.49 July 23, 2026 07:16
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.49 to main July 23, 2026 07:48
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.49 July 23, 2026 07:48
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks, @RaviTharuma! 🙏 Merged after scoping to guardrails/security: kept the INPUT_SANITIZER block-threshold wiring + PII request-rewrite gate + severity docs, dropped the unrelated js-yaml/tar/shell-quote/brace-expansion override bumps, and isolated sanitizer-residual-policy.test.ts to a tmp DATA_DIR so it no longer touches the real storage.sqlite. Rebased onto the current release tip (resolved the SECURITY.md overlap with the just-merged #8113). Rule #20 respected (piiMasker/featureFlagDefinitions untouched).

@diegosouzapw
diegosouzapw merged commit 4fd1f0f into cheaper-inference:release/v3.8.49 Jul 23, 2026
3 checks passed
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…inference#8093) (cheaper-inference#8124)

Scoped to guardrails/security: dropped the unrelated js-yaml/tar/shell-quote/
brace-expansion override bumps, and isolated sanitizer-residual-policy.test.ts
to a tmp DATA_DIR so it no longer touches the real storage.sqlite.

Co-authored-by: RaviTharuma <RaviTharuma@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: rafaumeu <rafael.zendron22@gmail.com>
@RaviTharuma
RaviTharuma deleted the fix/sanitizer-enabled-defaults-8093 branch September 23, 2026 19:38
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…inference#8093) (cheaper-inference#8124)

Scoped to guardrails/security: dropped the unrelated js-yaml/tar/shell-quote/
brace-expansion override bumps, and isolated sanitizer-residual-policy.test.ts
to a tmp DATA_DIR so it no longer touches the real storage.sqlite.

Co-authored-by: RaviTharuma <RaviTharuma@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: rafaumeu <rafael.zendron22@gmail.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

Development

Successfully merging this pull request may close these issues.

fix(backend): prompt-injection guard wiring inconsistent across endpoints; medium patterns never block

3 participants