feat: add public policy preflight checks for paths, commands, and URLs#190
Merged
Conversation
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.
Summary
Exposes Fence's policy evaluation as a public preflight API, so embedders can use one fence.json as the source of truth for operations that don't go through the sandbox (e.g. agent tools like
glob/read_file/web_fetchbuilt on the Go stdlib).Resolves #189.
Thin exports of the internal predicates the hook integrations already use, so hook-mode, wrap-mode, and library checks can't drift. No
Manageror proxies required. Denials are typed errors with matched rule and reason. These are policy preflights, not enforcement - the sandbox and proxies remain authoritative (documented, including theCheckURLdeclared-URL-only caveat).Changes
internal/sandbox/path_check.go: generalizePathWriteBlockedError->PathBlockedError(addsOp; write messages unchanged); addCheckReadPathmirroring wrap-mode read semantics. Dangerous-path protection stays write-only by design.pkg/fence/fence.go: export the fourCheck*functions + typed-error aliases.CheckCommandisWrapCommand's preflight (chain/nestedsh -cparsing, SSH policy) without aManager.docs/library.md.