Repository navigation
feat(hub): read and change built-in guard modes (2.147.0) - #200
Merged
Merged
Conversation
Built-in guards (env files, the git dir, the agent-config tier) could only change through `c3 access builtin mode`. GET /api/hub/access/builtin lists each guard's live mode per realm, read through the keyring, and POST /api/hub/access/builtin/mode sets one. Tightening needs nothing; loosening needs a Desk client token and the glob typed back, since loopback and CSRF do not stop an agent posting to the Hub. Phone tokens are refused. Tests: tests/test_hub_builtin_routes.py; 888 hub/access/override tests pass. Claude-Session: https://claude.ai/code/session_01F6QMHB2mkrDJiQWfC1g9wy
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.
Built-in guards could only be changed with
c3 access builtin mode. This PR lets the Hub read them and change them, and it is the backend C3 Desk will use.GET /api/hub/access/builtinreturns each guard's live global mode, the projects that set their own mode, and a 0–3 strictness for every mode. Modes are read through the keyring, so a mode listed here is one that evaluation actually applies.POST /api/hub/access/builtin/modesets a mode. A mode at least as strict as the live one goes through as sent. A looser one needs a Desk client token and the glob typed back. Without the token the route returns 403 with the CLI command to run instead. Phone tokens are refused, so the mobile API still can't loosen a built-in guard.access_guard.builtin_strictness()ranks modes across tiers.defaultis a full deny for env files but read-only for the git dir, so comparing the mode names alone gives the wrong answer.Why a token: loopback and the CSRF guard stop browsers, but not a process on the same machine, so an agent can POST to the Hub. A Desk token can only be minted with
bootstrap.key, which agents can't read, and it is stored only as a hash.Temporary and per-session changes come in a follow-up PR (2.148.0).
Tests:
tests/test_hub_builtin_routes.py(10 cases). 888 hub/access/override tests pass and ruff is clean.https://claude.ai/code/session_01F6QMHB2mkrDJiQWfC1g9wy