Skip to content

feat(plugins): add in-process intercept hooks after secret-guard and permission gate - #1330

Closed
TheGreatAxios wants to merge 2 commits into
mainfrom
cl-9888-intercept-hooks
Closed

TheGreatAxios wants to merge 2 commits into
mainfrom
cl-9888-intercept-hooks

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Plugin modules register in-process intercept hooks (beforePrompt, beforeModel, afterTool) that compose into the posix tool chain immediately after secret-guard and permission, so denied calls never reach a hook
  • Hook failures are reported through a warning sink and never throw into the run; hook-mutated calls still pass downstream guards
  • File hooks stay observe-only and off the hot path

Verification

  • bun test src/plugins/intercept-hooks.test.ts passes (14 tests: inject, skip, replace, failure-is-logged, gate-still-enforced)
  • bun run check passes (lint, typecheck, full suite: 8349 pass, 0 fail)

Fixes CL-9888

Related to CL-5198

@linear-code

linear-code Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

CL-9888

CL-5198

…mission gate

beforeModel hooks could rewrite an allowed call into a
secret-guard/permission-denied shape (read -> .env, bash -> rm -rf /)
that executed without re-validation. The hook middleware now re-runs a
hook-replaced call through secret-guard plus the stack permission gate
before execution; mutated-to-denied answers with the denial directly
(never executes, never reaches afterTool). Unmutated calls are not
re-evaluated, so no double-prompt. Adds full-stack regression tests.
@TheGreatAxios

Copy link
Copy Markdown
Collaborator Author

Closing as stale — superseded by ongoing work. Reopen if still wanted.

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