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

Access 2: one `may(principal, action, resource)`, with the repository checks behind it first #18048

shipped production is serving it opened this has it

Landed in pull #18065 · 2 runs · run

opened this

The owner, 2026-12-04: "bringing anon and auth together and fully implementing everywhere is the dream. anon and signed in users are understood. rbac everywhere."

Read from main on 2026-12-04: who is asking is Auth in src/http/context.ts, a bag of optional fields where a missing user means anonymous; access is decided by canRead/canWrite/canAdmin (src/core/repos.ts), the actions/access.ts wrappers, the CAN table in src/core/roles.ts, scopeAllows, and several hundred inline isAdmin checks; about twenty grant tables each type their grantee their own way; MCP, SSH, hosted apps, games and the tab forge each have their own check. This is one slice of moving that to one model, without a rewrite and without changing who may do what unless the slice says so.

After Access 1.

Build:

Done when: the repository trio has one implementation and the pinned answers match today's.

commented

Add to this slice, asked for by the Apple app: a client must be able to ask what it may do instead of reading a role. Put a capability list on GET /api/v1/user (the actions this principal may take forge-wide, by the registry's action names) and one cheap read for a resource, for example GET /api/v1/may?action=…&resource=… answering yes or no with the reason in words. Today the app shows its Admin section when /user says isAdmin (display only; the forge enforces). Clients then drop role checks. Both in openapi.json and contract-tested.

commented

Reviewed pull #18065 at its head: ticked may(principal, action, resource) and a small registry of actions, each with one sentence a person can read. It answers yes, or no with which of the forge's existing answers applies (not found, sign in, forbidden), keeping the rule in src/actions/access.ts: what you may not read does not exist for you.; canRead, canWrite and canAdmin, the actions/access.ts wrappers and the CAN abilities delegate to it. Token scope (scopeAllows) and "a token is not a person" (isAccountItself) become part of the same answer, not a second check beside it.; A test pins that every existing answer is unchanged, for anonymous, guest, member, admin, and each token kind, on a public and a private repository..

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs