Skip to content

fix(security): stop masking PII in gateway responses; keep credential redaction - #756

Merged
seonghobae merged 1 commit into
mainfrom
fix/stop-masking-pii-email-20260819
Aug 19, 2026
Merged

fix(security): stop masking PII in gateway responses; keep credential redaction#756
seonghobae merged 1 commit into
mainfrom
fix/stop-masking-pii-email-20260819

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

Standing operator directive: 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.

What changed

  • Removed the email pattern from SECRET_PATTERNSredact_text now masks credential shapes only (API keys, tokens, passwords, bearer headers).
  • Left the existing audit-event/analytics-event trail (_append_audit_event, record_analytics_event) untouched — that's the audit leg of the policy, already present.
  • Not done here (explicit follow-up, not implied as complete): purpose-limited authorization and field-level encryption of PII at rest. See docs/planning/adrs/0010-pii-audit-not-mask.md for 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)
  • Updated tests/test_security_hardening.py::test_redaction_masks_credentials_but_not_email_pii to assert credentials stay masked while email PII passes through

… 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>
seonghobae added a commit that referenced this pull request Aug 19, 2026
… 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>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a8bb7a26-e763-4a70-9e58-5e732ecbbd22

📥 Commits

Reviewing files that changed from the base of the PR and between 23de371 and 13bf7e3.

📒 Files selected for processing (4)
  • .adr-config.yml
  • contextual_orchestrator/orchestrator.py
  • docs/planning/adrs/0010-pii-audit-not-mask.md
  • tests/test_security_hardening.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit a0d1878 into main Aug 19, 2026
32 checks passed
@seonghobae
seonghobae deleted the fix/stop-masking-pii-email-20260819 branch August 19, 2026 04:15

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before 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 head 13bf7e3aa8372d07b575f298a21c97d182584628.

  • 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"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 13bf7e3aa8372d07b575f298a21c97d182584628
  • Workflow run: 32213285278
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

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 success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before 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 head 13bf7e3aa8372d07b575f298a21c97d182584628.

  • 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"]
Loading

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