Repository navigation
fix: close the access-control holes found by the security audit (RANCH-8) - #258
Merged
Merged
Conversation
…NCH-8) One migration: AssistantAccountAccess.grantedById (backfilled from the last writer of each custom pick), McpOauthState.startedById and startedVia, and every pending sign-in state dropped: none could be re-checked at its callback. Co-Authored-By: Claude <noreply@anthropic.com>
…ANCH-8) Audit §1. POST /users and create_user copy a limited Admin's lists onto the new account in the transaction that creates it, and withhold the assistant when the Admin does not have it. A password or sign-in email change on an account that reaches beyond the Admin is refused, on the route and the tool alike. Disabling an account tells the access lists, which close what it holds open (used by the chat surface). Co-Authored-By: Claude <noreply@anthropic.com>
Audit §3. clientIdFromJwtPayload, which every chat surface asks, is an allowlist: a console session, an embed token, or the agent's own token. The browser-view link, both extension tokens and the file open link carry a purpose typ that their own endpoints accept (and none, for tokens from before) and JwtAuthGuard refuses. A disabled or deleted account's console session is refused on chat paths and its sockets close. Spec fixtures that stood for console tokens gain the sid every console token carries. auth.types also carries the RANCH-8 grant helpers (grantedBy, noteGrantNotCovering) used by the grant commit. Co-Authored-By: Claude <noreply@anthropic.com>
…(RANCH-8) Audit §2. Every caller-facing file surface holds WorkspaceFiles instead of the raw gateway: data/secrets/, data/channels/, data/channels.json and browser-state/ are left out of lists, refused on read, write, delete and open link however the path is spelled, skipped by folder deletes and exports (with a note in the archive) and never written or removed by an import. The census refuses a route or tool that holds the raw gateway unless filed. Co-Authored-By: Claude <noreply@anthropic.com>
… (RANCH-8) Owner decision C10. The custom pick in force keeps who stated it (grantedById); the MCP handler notes that granter and manageCaller carries it on the party. canManage's assistant line also asks granterReaches: the Owner's pick works on every agent the person reaches, an Admin's only on agents that Admin reaches at the time of use, and none once the Admin is gone, disabled or a User. Refused for that reason alone, the tool says the ability does not cover that agent (reason not_covered) and names nobody. A limited Admin's new account without the assistant gets an exception switching it off (withholdFor). Co-Authored-By: Claude <noreply@anthropic.com>
…CH-8) Owner decision C11. start_mcp_oauth refuses every non-Owner on the Ranch assistant, whatever the subject, and a subject that is not the caller's own anywhere. The runtime route lets through only the Owner's identity on the assistant. The state records who started it, and the callback asks again with that account as it is then, before the code exchange: a refused sign-in stores nothing. Co-Authored-By: Claude <noreply@anthropic.com>
…grant (RANCH-8) The new-account form shows a limited Admin an amber block directly above Create user: the account will reach only the agents they can see, and only the Owner can give it more. The assistant-access row and the custom-pick sheet say that abilities they tick work only on agents they can see. Both read the viewer's own row from the user store; nothing is shown to the Owner or an Admin with no lists. Co-Authored-By: Claude <noreply@anthropic.com>
Route descriptions only; no DTO changed. Co-Authored-By: Claude <noreply@anthropic.com>
…ing stack (RANCH-8) audit-accounts, audit-chat-credentials, audit-files, audit-grants and audit-signin assert the fixed behaviour; against a build from before the fix their audit checks fail. accounts and grants also check the new admin copy at 390 and 1440 px. Registered in all.mjs. Co-Authored-By: Claude <noreply@anthropic.com>
…e-only files (RANCH-8) The feature dir of specs/042-audit-access-holes with its tasks. The CLEAN-254 text in specs/034 and specs/032 gets a RANCH-8 amendment: an Admin's pick works only within that Admin's current reach. docs/agent-tools.md: the granter clause, secrets kept in the workspace, the subject rule of the review checklist. docs/guides/auth.md: the accepted chat credentials and the purpose typs. Co-Authored-By: Claude <noreply@anthropic.com>
A limited Admin turning the switch back on for a pick the Owner made kept the Owner as its granter, so the User's abilities worked on every agent the Owner reaches. Any Admin save now records the Admin as the granter; only the Owner or a trusted party carries the earlier granter along. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Plane: RANCH-8 · Spec:
specs/042-audit-access-holes/· Release 0.3.130Closes the five access-control holes the security audit found.
What changes
POST /usersandcreate_usercopy the creator's access lists in the same transaction.clientIdFromJwtPayloadis now an allowlist: console session (sid), embed token, or the agent's own token.typ(vnc,ext-browser,ext-integration,open-link), andJwtAuthGuardrefuses them.WorkspaceFileswrapper deniesdata/secrets/,data/channels/,data/channels.jsonandbrowser-state/whatever the spelling, on every file surface, for the Owner too.SECRET_STORES_NOT_EXPORTED.txt. Import never removes them.AssistantAccountAccess.grantedByIdrecords the granter.canManagechecks at the time of use that the granter still reaches the agent. A gone, disabled or demoted granter gives nothing.not_covered. The console shows a note to a limited Admin inAccountRowandAdvanced.start_mcp_oauthrefuses anyone but the Owner on the Ranch assistant. Elsewhere it accepts only the caller's own subject (SUBJECT_NOT_YOURS).adminor a live Owner.Migration
20261201120000_audit_access_holes:grantedById, backfilled from the last writer of each custom pick;McpOauthState.startedByIdandstartedVia;Checks
api jest, full suite, once: 6604/6619 tests passed. All 15 failures were fixtures with console tokens that lacked
sid, which the allowlist now correctly refuses. After the fixtures were fixed, those 3 suites passed 349/349. The granter fix added 2 specs;assistantAccesspasses 165/165.Builds and generated clients: API build,
generate:swaggerand the regenerated admin/app SDKs all OK.nuxt typecheckexits 0 for admin and for app.Script checks:
locale:checkandi18n:checkare clean;test:scriptspasses 245.Audit reproductions against the local stack (postgres, API, fake runtime, both consoles). Each script failed on the old build and passes on this branch:
audit-accounts37/37audit-chat-credentials48/48audit-files58/58audit-grants33/33audit-signin19/19032 regression set: 16 of 18 scripts pass. The 2 that fail are:
routes37/40:GET /me/activityandPOST /me/chats/seenare missing from the script's User-route list;enforce114/116: a 404 onPOST /me/chats/seenafter access is removed.Both involve CLEAN-285 routes this branch does not touch. They were not measured on main.
Gaps: there was no S3 locally, so file list, export and import for story 3 are covered by API specs only. There was no real OAuth provider, so an allowed sign-in was checked up to discovery.
Visual check
Passed at 390×844 and 1440×900, with no console errors and no failed requests.
Twin consoles
🤖 Generated with Claude Code