fix(security): stop masking PII in gateway responses; keep credential redaction - #756
Conversation
… redaction Standing operator directive (this session): PII masking was paralyzing downstream consumers of this org's shared LLM gateway. Found the actual mechanism: SECRET_PATTERNS mixed a blanket email-address regex in with genuine credential patterns (API key/token/password/bearer), and server.py's _response_payload applies redact_value to every API response unconditionally, for every caller, with no purpose check. Every email address in every response this gateway ever served was replaced with [REDACTED] -- catastrophic for any consumer needing real content (e.g. naruon, an email workspace app, routing through this gateway). governance-risk-compliance's own stated org policy: PII is protected by purpose-limited authorization, encryption, and audit logging, not by masking it out of existence. Implemented the first, immediately-safe part of that: removed the email pattern from SECRET_PATTERNS (redact_text now masks credential shapes only) and left the existing audit-event/analytics- event trail (_append_audit_event, record_analytics_event) untouched as the audit leg of the policy, already present before this change. Purpose-limited authorization (caller/role-scoped PII access) and field-level encryption of PII at rest are explicit, tracked follow-up -- not implied as done by this change. See docs/planning/adrs/0010-pii-audit- not-mask.md for the full decision record and conductor/tracks/003-autonomous-pr-ecosystem-loop/plan.md for the follow-up tracking. Full suite green (414 unit + 10 fuzz), local semgrep --config=p/default (the exact CI command) 0 findings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… fix The PII-masking item is finally done (not just researched): found the actual mechanism in this repo's own SECRET_PATTERNS/_response_payload, fixed per governance-risk-compliance's stated policy, shipped as #756 with an ADR explicitly scoping what's done vs. follow-up. Also fixed strix.yml's real pip install (same resolver conflict as pip-audit, but --no-deps alone since --disable-pip doesn't apply to a real install) on .github#1121, and triaged all 5 .github Dependabot alerts as stale/ already-fixed. Noted contextual-orchestrator's own Dependabot PR branches as unexamined follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 59 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
OpenCode cannot approve yet because required coverage evidence did not pass.
Review outcome
1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence
-
Problem: The required coverage-evidence job result was
failure, so OpenCode cannot establish approval sufficiency for this head. -
Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.
-
Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports
successwith required evidence or explicit no-source not-applicable evidence. -
Regression test: Keep the approval branch checking
needs.coverage-evidence.result == successbefore posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present. -
Result: REQUEST_CHANGES
-
Reason: coverage-evidence result was
failure, so required test/docstring evidence was not proven for current head13bf7e3aa8372d07b575f298a21c97d182584628. -
Head SHA:
13bf7e3aa8372d07b575f298a21c97d182584628 -
Workflow run: 32213285278
-
Workflow attempt: 1
Coverage evidence
Coverage evidence job did not run or did not publish coverage evidence.
Changed-File Evidence Map
flowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Changed file (2 files)"]
S1 --> I1["repository behavior"]
I1 --> R1["Review risk: Changed file (2 files)"]
R1 --> V1["required checks"]
Evidence --> S2["Docs: 0010-pii-audit-not-mask.md"]
S2 --> I2["operator or user guidance"]
I2 --> R2["Review risk: Docs: 0010-pii-audit-not-mask.md"]
R2 --> V2["docs review"]
Evidence --> S3["Test: test_security_hardening.py"]
S3 --> I3["regression suite"]
I3 --> R3["Review risk: Test: test_security_hardening.py"]
R3 --> V3["targeted test run"]
OpenCode Review Overview
Pull request overviewOpenCode cannot approve yet because required coverage evidence did not pass. Review outcome1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence
Coverage evidenceCoverage evidence job did not run or did not publish coverage evidence. Changed-File Evidence Mapflowchart LR
PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
Evidence --> S1["Changed file (2 files)"]
S1 --> I1["repository behavior"]
I1 --> R1["Review risk: Changed file (2 files)"]
R1 --> V1["required checks"]
Evidence --> S2["Docs: 0010-pii-audit-not-mask.md"]
S2 --> I2["operator or user guidance"]
I2 --> R2["Review risk: Docs: 0010-pii-audit-not-mask.md"]
R2 --> V2["docs review"]
Evidence --> S3["Test: test_security_hardening.py"]
S3 --> I3["regression suite"]
I3 --> R3["Review risk: Test: test_security_hardening.py"]
R3 --> V3["targeted test run"]
|
Summary
Standing operator directive: PII masking was paralyzing downstream consumers of this org's shared LLM gateway.
Found the actual mechanism:
SECRET_PATTERNSmixed a blanket email-address regex in with genuine credential patterns (API key/token/password/bearer), andserver.py's_response_payloadappliesredact_valueto every API response unconditionally, for every caller, with no purpose check. Every email address in every response this gateway ever served was replaced with[REDACTED]— catastrophic for any consumer needing real content (e.g.naruon, an email workspace app, routing through this gateway).governance-risk-compliance's own stated org policy: PII is protected by purpose-limited authorization, encryption, and audit logging, not by masking it out of existence.What changed
SECRET_PATTERNS—redact_textnow masks credential shapes only (API keys, tokens, passwords, bearer headers)._append_audit_event,record_analytics_event) untouched — that's the audit leg of the policy, already present.docs/planning/adrs/0010-pii-audit-not-mask.mdfor the full decision record.Test plan
python -m pytest tests -q --ignore=tests/fuzz(414 passed),python -m pytest tests/fuzz -q(10 passed)semgrep scan --config=p/default --severity=WARNING --severity=ERROR --exclude=.github/workflows --exclude='docs/research/**/standards' --error(0 findings)tests/test_security_hardening.py::test_redaction_masks_credentials_but_not_email_piito assert credentials stay masked while email PII passes through