Repository navigation
feat(redact): match text as written or by regex, case switch; v0.71.0 - #331
Merged
Merged
Conversation
…nsitive on request A custom redaction rule now says how it matches: `match: contains` looks for the text as written (characters such as `.` and `*` have no special meaning), `match: regex` is a regular expression. `contains` is the default, so a word typed in as-is just works. `case_sensitive: true` tells capital letters from small ones; by default they are not told apart. - tw-guard: `Pattern` carries text, regex or not, and case; the rule set, the policy, the trial and the views use it. Code points are refused for redaction (`config.rule_match_bad`, `security.redact_match_bad`). - tw-api 47: `CustomRuleSave` and `SecurityTestRequest` take `match` and `case_sensitive` for redaction; `Matcher` `contains` / `regex` and `RuleSnapshot` say whether a rule is case-sensitive. - The configuration manual documents both fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…les search them Pre-release review found the identifier skip list too broad: every rule, built-in ones included, skipped any `*_id` / `*Id` value, so a key under `aws_access_key_id` or a phone number under `user_id` in tool arguments was no longer replaced. Keys stay off-limits for every rule; the values of the protocol's own identifier keys (an explicit list, no suffix guessing) are skipped by custom rules only. Tool-call regexes that start with `(?i)` now report `case_sensitive: false`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What
Custom redaction rules choose how they match, like content rules already do:
match: contains(default): the text is looked for as written;.,*and the like have no special meaning.match: regex: a regular expression.case_sensitive: true: tell capital letters from small ones. Off by default.match: codepointsis refused for redaction (config.rule_match_badin the configuration,security.redact_match_badfrom the control API).Contract (control API 47)
CustomRuleSave/SecurityTestRequest:matchnow applies to redaction too; newcase_sensitive.matcheriscontainsorregex; both variants carrycase_sensitive(tool-call regexes reporttrue).RuleSnapshot: newcase_sensitive; custom redaction rules now carrymatching.matchused to be a regex and is now matched as written.Tests
cargo test --workspace, clippy and fmt pass locally; the configuration manual and the message-code manifest are regenerated.🤖 Generated with Claude Code