Repository navigation
docs(architecture): reconcile Invariant #8 with the ent#293 gate fix (#1890, #1821) - #2062
Merged
Merged
Conversation
…1890, #1821) `#1890` moved the agent-principal rejection into `require_admin`/`assert_admin` themselves, but Invariant #8 still described the pre-fix model — that the admin gates answer "what role" and never "is this a human", and that an operator-scale endpoint therefore needs `reject_agent_principal` bolted on *in addition to* the role gate. That is precisely the per-endpoint pattern #1890 eliminated, so left as-is the doc would tell the next contributor to re-implement the thing that was just centralised, on a security invariant. Rewrites that paragraph to describe the gate as the mechanism, records the two admin-gated reads that were re-opened as *uses* rather than grants (and why `GET /api/subscriptions` is owner-scoped rather than un-gated), and writes down the new hard rule — never `require_role("admin")` — which until now lived only in a docstring and an AST guard. Also updates the `assert_admin` helper description in the same invariant, and the `PUT /api/agents/{name}/label` row for #1821 (`label` is now required-but-nullable with `extra="forbid"`; `{}` and unknown fields 422). Docs only — no code, no schema, no behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Resolve by running |
vybe
approved these changes
Aug 9, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
Verified against merged code: require_admin/assert_admin both call reject_agent_principal; trigger_health_check is get_current_user + AuthorizedAgentByName; list_subscriptions branches on role == "admin" and not agent_name. Docs-only, no closing keyword by design. Approving.
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.
Docs only. Follow-up I committed to while approving #1890, raised there rather than pushed to that branch because eight in-flight PRs touch
architecture.mdand batching avoids compounding the conflict.Why this is a defect, not tidying
#1890 moved the agent-principal rejection into
require_admin/assert_admin. Invariant #8 still described the pre-fix model:Both halves are now false, and the second is actively harmful: it is exactly the bolt-it-on-per-endpoint pattern #1890 eliminated after five occurrences of the class. Left standing, the doc instructs the next contributor to re-implement what was just centralised — on a security invariant, in the file
CLAUDE.mdRule 7 tells everyone to read before adding an endpoint.The helper list in the same invariant also still described
assert_adminas_reject_connector_principal+ role only.What changed
Role ≠ humanparagraph →An admin gate is never agent-callable (ent#293/ent#297). States the gate as the mechanism; keeps the reason (an agent key resolves to its owner carrying the owner's role) since that is what makes the design non-obvious; records that per-endpointreject_agent_principalcalls are now belt-and-braces rather than the mechanism.POST /api/monitoring/agents/{name}/checkandGET /api/subscriptionswere uses, not grants. Notes specifically that the subscription read is owner-scoped, not un-gated — un-gating was the first attempt and would have handed anyrole=usera fleet-wideowner_email+ agent-name enumeration oracle, reintroducing the Invariant security: implement safe tar extraction with symlink/hardlink validation #8 disclosure class via a fix for a different disclosure. That trap is worth being written down.require_role("admin"). It rejects connector but not agent principals, andrequire_rolestays permissive on purpose (ghost spawning goes throughrequire_role("creator"), ent#69 Part 2). Until now this lived only in a docstring and an AST guard — findable after you have already made the mistake.PUT /api/agents/{name}/labelrow updated for PUT /agents/{name}/label silently clears the label (200) when the body uses an unknown field name #1821:labelis required-but-nullable withextra="forbid", so{}and unknown field names 422 instead of silently clearing.Verification
dependencies.pyrequire_admin/assert_adminboth callreject_agent_principal;monitoring.trigger_health_checkisget_current_user+AuthorizedAgentByName;subscriptions.list_subscriptionsbranches onrole == "admin" and not agent_name.enterprise-docs-guardpattern against the added lines — clean, no paid-feature orenterprise_*token./validate-configorschema-parityto act on.Fixes are already merged (#1890, #1822); this carries no closing keyword by design — it documents them rather than resolving a separate issue.
🤖 Generated with Claude Code