fix(py): caveats=None and omitted axes are deny-all, not full authority (AB-009) - #303
Merged
Merged
Conversation
…ty (AB-009)
WHAT: The Python facade defaulted fail-OPEN. `invoke(caveats=None)` minted
Caveats::top() (full ambient authority) behind a stderr warning, and
caveats_from_py defaulted every OMITTED axis to top (Scope::top() /
CountBound::top()). So a partial dict like {"exec": {"only": ["echo"]}} silently
granted top fs_read/fs_write/net and unlimited max_calls.
Now both default to DENY-ALL, mirroring the MCP frontend's caveats_source::deny_all:
- new `deny_all()` helper; invoke's None branch returns it (warning removed — a
warning is not an authority boundary);
- caveats_from_py omitted-axis defaults flip top -> bottom (Scope::none(),
CountBound::AtMost(0));
- module docs corrected. Full ambient authority must now be asked for explicitly
(every axis "all") — the existing "all" literals already support it.
WHY: #271 / AB-009 — a fail-open confinement default reachable through a shipped
frontend. Regression tests (validated locally against a built wheel): caveats=None
denies; an omitted axis (max_calls) denies; and the explicit all-axes escape hatch
still runs. Positive fixtures now name the axes they need (previously implicit
under omitted-defaults-to-top).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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
Fixes #271 / AB-009 — the Python facade defaulted fail-open.
invoke(caveats=None)mintedCaveats::top()(full ambient authority) behind a stderr warning, andcaveats_from_pydefaulted every omitted axis to top — so a partial dict like{"exec": {"only": ["echo"]}}silently granted topfs_read/fs_write/netand unlimitedmax_calls.Both now default to deny-all, mirroring the MCP frontend's already-correct
caveats_source::deny_all:deny_all()helper;invoke'sNonebranch returns it (warning removed — a warning is not an authority boundary);caveats_from_pyomitted-axis defaults flip top → bottom (Scope::none(),CountBound::AtMost(0));Full ambient authority must now be asked for explicitly (every axis
"all") — the existing"all"literals already support it, so no new API surface.Test plan
Validated locally against a built wheel (isolated venv, never
~/venv) — 18/18 pass:test_caveats_none_is_deny_all—caveats=None→BridleDenied(was: ran unconfined).test_missing_axis_defaults_to_bottom— omittingmax_callsunder anexecgrant →BridleDenied.test_explicit_all_axes_still_runs_unconfined— the deliberate escape hatch works.ECHO_ONLY) now name the axes they need (previously implicit under omitted-defaults-to-top; a restricted fs/net axis the host can't enforce correctly refuses to run).CI's "python wheel + pytest (Pillar A)" job runs these. Rust
clippy -D warningsclean; pre-push[pre-push] OK.Scope
Contained to the
agent-bridle-pyfacade. Brings it to parity with MCP's fail-closed default. No cross-crate API change.Fixes #271
🤖 Generated with Claude Code