Skip to content

feat(hub): read and change built-in guard modes (2.147.0) - #200

Merged
drknowhow merged 1 commit into
mainfrom
feat/hub-builtin-modes
Sep 23, 2026
Merged

drknowhow merged 1 commit into
mainfrom
feat/hub-builtin-modes

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

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/builtin returns 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/mode sets 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. default is a full deny for env files but read-only for the git dir, so comparing the mode names alone gives the wrong answer.
  • The Hub's Access tab gets a Built-in guards panel. It tightens in place and shows the CLI command when a change would loosen a guard.

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

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
@drknowhow
drknowhow merged commit 755b159 into main Sep 23, 2026
12 checks passed
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