Skip to content

redact: fail visibly when custom rules are configured but inactive - #3248

Open
Joystonm wants to merge 1 commit into
entireio:mainfrom
Joystonm:fix/redact-inactive-custom-rules
Open

Joystonm wants to merge 1 commit into
entireio:mainfrom
Joystonm:fix/redact-inactive-custom-rules

Conversation

@Joystonm

Copy link
Copy Markdown

A user can configure redaction.custom_redactions or .entire/redactors/ packs and end up with zero rules in the detection pipeline: every inline pattern fails to compile or can match the empty string, every pack rule is rejected, or every pack file fails to load. The setting still says the protection is on, so the user believes their own rules are filtering content that nothing filters. Built-in detection keeps running, so the gap is easy to miss.

Report the gap and fail closed at the push boundary:

  • redact.CustomRulesStatus reports the configured count beside the active count, and redact.Counts.CustomRulesConfigured persists the configured count so a checkpoint written while the rules were inert stays identifiable after they are fixed.
  • strategy.EnsureRedactionConfigured records the inert state as an *InactiveCustomRulesError and warns (log component=redaction, plus a stderr breadcrumb on an interactive run). A configuration with at least one active rule is not inert and never gates a push.
  • Every checkpoint-push path (strategy.PushCheckpoints, strategy.PushQueuedCheckpointRefs, and the git-refs and git-branch pre-push flushes) withholds delivery and leaves the refs queued. The user's own git push is never blocked.
  • entire checkpoint explain shows custom 0 (N rules configured, none active) for checkpoints written while the rules were inert.

The write path stays fail-open: the transcript is still written, because the built-in detectors keep protecting the content and a broken rule must not cost a user their session. Only delivery of what the user's own rules were meant to filter fails closed.

Entire-Checkpoint: 01M8KXY400GA0HZZ8SF697VNVF

A user can configure `redaction.custom_redactions` or `.entire/redactors/`
packs and end up with zero rules in the detection pipeline: every inline
pattern fails to compile or can match the empty string, every pack rule is
rejected, or every pack file fails to load. The setting still says the
protection is on, so the user believes their own rules are filtering content
that nothing filters. Built-in detection keeps running, so the gap is easy to
miss.

Report the gap and fail closed at the push boundary:

- `redact.CustomRulesStatus` reports the configured count beside the active
  count, and `redact.Counts.CustomRulesConfigured` persists the configured
  count so a checkpoint written while the rules were inert stays
  identifiable after they are fixed.
- `strategy.EnsureRedactionConfigured` records the inert state as an
  `*InactiveCustomRulesError` and warns (log `component=redaction`, plus a
  stderr breadcrumb on an interactive run). A configuration with at least one
  active rule is not inert and never gates a push.
- Every checkpoint-push path (`strategy.PushCheckpoints`,
  `strategy.PushQueuedCheckpointRefs`, and the git-refs and git-branch
  pre-push flushes) withholds delivery and leaves the refs queued. The user's
  own `git push` is never blocked.
- `entire checkpoint explain` shows `custom 0 (N rules configured, none
  active)` for checkpoints written while the rules were inert.

The write path stays fail-open: the transcript is still written, because the
built-in detectors keep protecting the content and a broken rule must not cost
a user their session. Only delivery of what the user's own rules were meant to
filter fails closed.

Co-Authored-By: Claude <noreply@anthropic.com>
Entire-Checkpoint: 01M8KXY400GA0HZZ8SF697VNVF
@Joystonm
Joystonm requested a review from a team as a code owner November 29, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant