Skip to content

feat(security): set what enforce does for each built-in tool rule - #88

Merged
fylorn merged 1 commit into
mainfrom
feat/builtin-rule-action
Sep 21, 2026
Merged

fylorn merged 1 commit into
mainfrom
feat/builtin-rule-action

Conversation

@fylorn

@fylorn fylorn commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

A built-in tool-call rule's action (cut off or record only) becomes a setting, like a custom rule's. A built-in rule supplies a regular expression and a factory action; whether a match is cut off in enforce mode is the user's call. Until now the only way to change it was to copy the rule as a custom one and turn the original off.

Configuration

security:
  inspect_tools:
    actions:
      rm-rf-root: cut        # factory: record
      curl-pipe-sh: record   # factory: cut

Only actions that differ from the factory are written. An id that is not a built-in rule is reported with the other unknown ids in GET /security and ignored, the same as enable and disable.

Control API

  • PUT /security/inspect_tools/builtin/{id}/action with { action, base_version } writes one line, or removes it when the action goes back to the factory one. redact answers security.no_action: what happens to a redaction match is decided by the mode.
  • GET /security gives each built-in tool rule its effective action and its default_action.
  • POST /security/inspect_tools/test with rule reports the effective action.

Additive: CONTROL_API_VERSION unchanged.

Tests

  • A built-in rule that ships as record-only cuts off once set to cut, end to end through the gateway.
  • Rule compilation applies the override, keeps the factory action otherwise, and reports an unknown id.
  • The control API writes the line, reports the effective and factory actions, tries the rule with the new action, removes the line when set back (the file is byte-identical), and refuses a redaction rule, an unknown rule and an unknown action.
  • cargo test --workspace (1508 passed), clippy -D warnings, fmt.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the feat/builtin-rule-action branch from 857f636 to 06a978d Compare September 21, 2026 18:01
@fylorn
fylorn merged commit 379f4f5 into main Sep 21, 2026
1 check passed
@fylorn
fylorn deleted the feat/builtin-rule-action branch September 21, 2026 18:09
@fylorn fylorn mentioned this pull request Sep 21, 2026
fylorn added a commit that referenced this pull request Sep 21, 2026
Built-in redaction rules find a key right after a JSON escape (#87), and
a built-in tool-call rule's action on enforce is a setting (#88).
Additive; CONTROL_API_VERSION unchanged.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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