Repository navigation
feat(redaction): additive shape-based redaction on top of the existing redactor (see Consiliency/pmcp#234) - #310
Merged
Merged
Conversation
…g redactor (see #234) The embedded patch of the merged plan (.consiliency/plans/detailed-234-redactor-shape-based-20260923-0921.md), applied with its own extractor to 4d2790f. pyproject.toml, src/ and tests/ equal wip/234-additive @ 4f2ca0a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
…at ends in a key (see #234) The implementation board's N-1: an ARN body glued between two markers stopped the follow-on, so a second key's tail after it survived (`token=Ab3cd:aws:s3:::x/token=Zz9!TAIL77`). The chain now goes past an ARN body when the body ends in a key's `=` glued to the next marker. A key inside an ARN's resource after the redactor's marker inside the ARN still keeps its tail; that is pinned and disclosed, and the F-2 claim is narrowed in the docstring, the test comments and the plan's Residuals. Docs: a CHANGELOG Security entry, SECURITY.md's redaction paragraph widened to the added rules, and CONTRIBUTING's note on the slow tier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
The follow-on across markers goes past an ARN body only when it ends in a key's `=`. A second key written with `:` after an ARN body keeps its tail (`token=Ab3cd:aws:s3:::x/token:Zz9!TAIL77`; 875 E / 112 P of the implementation board's 1 500-case matrix with an ARN between, 0 / 0 without). The plan's Residuals sentence is narrowed and the `:`-keyed shape gets its own line; CHANGELOG and SECURITY.md now describe the glued text as "up to a delimiter; see the residuals". No code change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
The plan's summary of when "a value marked twice keeps no tail" holds contradicted itself; it now states the condition once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
This was referenced Sep 27, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds shape-based and separator-anchored secret redaction on top of the existing redactor, as the merged plan specifies (
.consiliency/plans/detailed-234-redactor-shape-based-20260923-0921.md, merged in #288). See #234._sanitize_baseinsrc/pmcp/auth.pyis its body, moved). The new rules (src/pmcp/redaction_additive.py) run over its output and can only replace more of it with[REDACTED].&,#, quotes, backslash,,,;,(,[,{and<;=);sanitize_auth_diagnostic,PolicyManager.redact_secrets, andprocess_outputon a string and on a structured result.Commits:
58a7f95: the plan's embedded patch, applied with its own extractor to4d2790f.pyproject.toml,src/andtests/equalwip/234-additive@4f2ca0a.4593c78: the implementation board's N-1 and the documentation.=, sotoken=Ab3cd:aws:s3:::x/token=Zz9!TAIL77loses!TAIL77. There is a test, and the mutant is rev 19's rule.### Securityentry, SECURITY.md's redaction paragraph, and CONTRIBUTING's slow-tier note.cdd6607and a follow-up commit: docs only. They narrow the N-1 residual to=-keyed follow-on values, and make CHANGELOG and SECURITY.md say "the text glued to the end of an existing marker (up to a delimiter; see the residuals)".Guarantees (tests in
tests/test_redaction_additive.py)_sanitize_baseequals the vendored redactor (tests/_main_redactor.py) on every corpus. Each unmarked stretch of the output occurs, in order, in the base output. A piece-level differential runs on tier 1 (default tier) and tier 2 (slow tier).tests/test_keyword_matcher.pypasses unchanged with--cov.Purpose tests:
%xx) is removed on all surfaces;Every fix has a mutant.
Residuals (disclosed in the plan)
,,;,&,#,(,[,{or<, or after punctuation alone before such a stop.--password v) stays: 353 of 500 in the seat's corpus. Extending the rule was not approved.token: bearer<escape>vkeeps the token in 13 % (28 % bracketed) of that shape, on E, P and POd.|and:fields. A code or log field after|or:is taken with the value the redactor marked. It is over-redaction: 168 E / 152 P of 120 000 natural key-word lines differ from rev 17.:-keyed value after an ARN body.token=Ab3cd:aws:s3:::x/token:Zz9!TAIL77keeps!TAIL77, as the existing redactor does. The tail survives in 875 E / 112 P of a 1,500-case matrix with an ARN in between, and 0 / 0 otherwise. The code does not treat:like=, because that would take a secretsmanager ARN's account and resource.process_outputis capped at 50 KB by default.Verification (as read from the logs, dev0, npm/pnpm store variables unset)
ruff check src/ tests/ruff format --check src/ tests/mypy src/pytest tests/test_keyword_matcher.py --cov=pmcp-m 'not live and not slow'-m 'slow and not live'The slow tier's log starts with a faulthandler stack dump at 120 s. That dump comes from
test_floor_on_tier_2, which took 128.77 s and passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.