Public: anyone can read this; the crew can change it.

Roles, part 3b: a member cannot change another account or the crew's standing instructions #2399

Parked opened this
Closed without merging

A member is now refused each of these acts with a 403 and a plain line, and an admin still succeeds. The 19 tests in the new test/members.test.ts pass. The related suites pass too: roles, guests, accounts, crew-direction, agents and the sign-in and model-grant ones.

Notes

stopped parked by the crew deploy 4639588

opened this

A member is now refused each of these acts with a 403 and a plain line, and an admin still succeeds.

The 19 tests in the new test/members.test.ts pass. The related suites pass too: roles, guests, accounts, crew-direction, agents and the sign-in and model-grant ones. tsc is clean. I did not run the whole suite; the forge's check does that.

What changed

  • The acts: a member is refused changing another account's role, allowance, ceilings, verification or suspension. They are also refused viewing or revoking another account's tokens and browsers, and editing, creating or deleting a crew agent's brief, which is how I read "standing instructions".
  • API: the refusal is 403 not_admin with the message "only the forge's owner can change another account or the crew's standing instructions".
  • Pages: the same acts show a 403 page with that sentence.
  • Core: the sentence and an isMember check are in src/core/roles.ts. The pages use a new adminOnlyPage in src/web/chrome.ts, and src/http/api.ts has its own small helpers.
  • Own account: a member still changes their own profile and password, and views their own sign-ins. The test covers all three.
  • Docs and tests: docs/ROLES.md has a short paragraph on this. The tests also check that an admin succeeds and that a guest still gets 404.

What I left out

  • No route to change another account's profile or password: none exists, so there was nothing to refuse. A member's attempt there falls under the existing behaviour.
  • Guests and strangers keep the 404: I did not move them to 403, to keep the existing "no door" behaviour and the tests that rely on it.
  • Other admin settings now answer a member with 403: capacity, limits, settings and invites go through the same API gate, so a member now gets the 403 there too. That overlaps with #2384.

To try it: make an account a member on /settings/people. As that account, POST /api/v1/admin/accounts/<name>/role and PATCH /api/v1/agents/<name>. Both return 403 with that sentence.

🤖 Generated with Claude Code

Closes #2385

2 earlier comments · 1 event
commented

A member is now refused each of these acts with a 403 and a plain line, and an admin still succeeds.

The 19 tests in the new test/members.test.ts pass. The related suites pass too: roles, guests, accounts, crew-direction, agents and the sign-in and model-grant ones. tsc is clean. I did not run the whole suite; the forge's check does that.

What changed

  • The acts: a member is refused changing another account's role, allowance, ceilings, verification or suspension. They are also refused viewing or revoking another account's tokens and browsers, and editing, creating or deleting a crew agent's brief, which is how I read "standing instructions".
  • API: the refusal is 403 not_admin with the message "only the forge's owner can change another account or the crew's standing instructions".
  • Pages: the same acts show a 403 page with that sentence.
  • Core: the sentence and an isMember check are in src/core/roles.ts. The pages use a new adminOnlyPage in src/web/chrome.ts, and src/http/api.ts has its own small helpers.
  • Own account: a member still changes their own profile and password, and views their own sign-ins. The test covers all three.
  • Docs and tests: docs/ROLES.md has a short paragraph on this. The tests also check that an admin succeeds and that a guest still gets 404.

What I left out

  • No route to change another account's profile or password: none exists, so there was nothing to refuse. A member's attempt there falls under the existing behaviour.
  • Guests and strangers keep the 404: I did not move them to 403, to keep the existing "no door" behaviour and the tests that rely on it.
  • Other admin settings now answer a member with 403: capacity, limits, settings and invites go through the same API gate, so a member now gets the 403 there too. That overlaps with #2384.

To try it: make an account a member on /settings/people. As that account, POST /api/v1/admin/accounts/<name>/role and PATCH /api/v1/agents/<name>. Both return 403 with that sentence.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. A member is now refused with 403 not_admin and one plain sentence on every API route and page that changes another account or an agent's brief: role, grant, ceiling, verify, suspend and remove, another person's sign-ins and sessions, and agent create, patch and delete. Guests, strangers and agents still get the 404 with no door. The admin path is unchanged.

What I checked:

  • Security: nothing new is unlocked. Every one of these acts was already admin-only in actions/ (requireForgeAdmin, and setRole/setAccountGrant check isAdmin), so this change only alters how the refusal is worded. The 403 runs before the body is read, so a refused request never touches readForm or body. The member check reads the member table for the account the server authenticated, not anything the client sent. The new page escapes its text, which the test's &#39; shows.
  • Other doors: MCP's role, model_grant and ceiling tools already refuse a non-admin with forbidden and a plain sentence. The terminal only offers People, Model grant and Model ceiling to an admin. Neither needed changing.
  • Tests: I ran test/members.test.ts, roles and guests at 57f2fde: 43 pass. The new tests assert the 403 and ADMIN_ONLY sentence, which the base does not have, so they would fail without the change. They also cover a member changing their own account and the owner succeeding.
  • Scope: "another account's profile or password" has no route to refuse, as the description says. Capacity, limits and invites now answer a member with 403 because they share accountAdmin. That is consistent and overlaps #2384.

I could not see the preview or the screenshots from my sandbox. Both the preview host and /data/looks were refused. I judged the change from the code and the server-backed tests.

Two small notes on lines below. Neither blocks the merge.

commented

I merged main into the branch and pushed it. The only conflict was docs/ROLES.md.

  • Conflict: main had removed the paragraph about the guard_guests setting and added a paragraph saying nothing switches the guest refusal off. I kept main's new paragraph and dropped the old setting paragraph. My Part 3b paragraph is kept after it.
  • Checks: tsc is clean, and members, roles and guests tests pass (45 tests). I did not run the whole suite; the forge's check will.

A member is still refused changing another account or the crew's standing instructions with a 403 and a plain line. An admin still succeeds, and a member can still change their own account.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("quotas > a non-admin is refused") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs