Repository navigation
Define the security model and hook API contract - #954
Merged
Merged
Conversation
4 tasks done
PR #954: Define the security model and hook API contract5 files, +203 / -0 Scope✅ PR scope looks good. Structural✅ No structural bloat detected. Slop✅ Slop indicators look low. Static Analysis✅ Oxlint found no issues. CorrectnessNo extraneous code patterns detected. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Follow-up to #953, which merged the necessity checks for agent plans and reviews.
Those checks need a concrete security model to distinguish necessary protection from speculative defensive complexity. A trusted plugin already runs native code; treating it as an adversary can produce elaborate protocols and tests without protecting a supported boundary.
What changes
Before: necessity checks exist, but the project has no consolidated statement of the threats that justify defensive mechanisms and adversarial tests.
After:
architecture.mdand the approved rulebooks record the security model and the hook adapter contract agreed with the Product Owner. The Architect and Planner guides link to that model when assessing defensive mechanisms, and verification guidance requires consequential failure paths rather than speculative permutations.The approved model states that installed native extensions and explicitly run documents are trusted programs; generated evaluation enforces the host's allowed operations; external data is validated at its owning boundary; history validation covers format and run/effect consistency without promising authenticity against deliberate local-database rewriting; and disclosure protection covers credentials and identified secrets rather than treating all paths and ordinary error details as secret. Reliability and compatibility requirements remain separate reasons for protection.
The PR also records the approved hook adapter contract:
The adapter uses
createApiinternally without modifying it. Registration is independent and scoped; handlers receive nonextor replacement return channel. Before hooks may reject by throwing. After hooks run in reverse order, including on rejection and cancellation, and receive Effection'sResult<TResult>with a dedicated cancellation error. Hook failures remain visible without rewriting completed effects or causing an automatic retry.Review guide
Start with
architecture.md→ Security model and Middleware and hooks. Then review the approved rules in.agents/architecture-rules.md, the evidence rule in.agents/product-verification.md, and the security-model links added to the Architect and Planner guides. The necessity-check changes from #953 are already on main.How to verify it
git diff --check HEAD^ HEADpasses.Follow-up implementation and API cleanup
createHooksand its first production consumers.#957's contract analysis can run alongside #956. Specification and necessity assessment in #958 can also proceed independently; changes to overlapping runtime code follow the hook migration and the relevant API contract decisions.
The hook primitive is a design contract in this PR. Runtime API conversion and the conformance cleanup are separate work; this PR changes no production code or tests.
Scope confirmation