Skip to content

feat(redact): match text as written or by regex, case switch; v0.71.0 - #331

Merged
fylorn merged 3 commits into
mainfrom
feat/redact-match-modes
Oct 12, 2026
Merged

fylorn merged 3 commits into
mainfrom
feat/redact-match-modes

Conversation

@fylorn

@fylorn fylorn commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

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: codepoints is refused for redaction (config.rule_match_bad in the configuration, security.redact_match_bad from the control API).

Contract (control API 47)

  • CustomRuleSave / SecurityTestRequest: match now applies to redaction too; new case_sensitive.
  • Rule view: a custom redaction rule's matcher is contains or regex; both variants carry case_sensitive (tool-call regexes report true).
  • RuleSnapshot: new case_sensitive; custom redaction rules now carry matching.
  • A custom redaction rule without match used 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

fylorn and others added 2 commits October 12, 2026 12:37
…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>
Custom redaction rules match text as written or by regex, with an optional
case switch; protocol 47.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn fylorn changed the title feat(redact): custom rules match text as written or by regex, case-sensitive on request feat(redact): match text as written or by regex, case switch; v0.71.0 Oct 12, 2026
…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>
@fylorn
fylorn merged commit 911f937 into main Oct 12, 2026
7 checks passed
@fylorn
fylorn deleted the feat/redact-match-modes branch October 12, 2026 05:33
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant