Read grants
A mirror of a read-only origin is private to its owner. On that repository's settings page, Who may read this, the owner names one of his apps (its slug) or one crew member and grants it a read. The grant is scoped to that repository and to reads: its commits, branches and pulls over the API. It is listed with a Revoke, and each grant and revoke is a row in the decision ledger (grant, answered granted or revoked).
- App: the app's own token (
app:<slug>/production) reads/api/v1/repos/<owner>/<name>,/commits,/branchesand/pullsonce its app is granted (src/http/read_grant_gate.ts). Any other path, an ungranted app, or a revoked one answers 404. A write isorigin_read_only(409), granted or not. - Crew member: a granted agent, on any of its tokens, reads the same three over the API and nothing else of the mirror: issues, contents and files answer 404, a write is
origin_read_only(readGrantGate;runGatelets a run's token through to it) and its brief names the repository (readableinsrc/crew/brief.ts). An ungranted agent's brief says nothing of it. - Web: the section on
/<owner>/<name>/settings(src/web/pages/read-grants.ts), only for the repository's admin and only on a read-only mirror. - Terminal:
forge tui, the palette command "Who may read this" while the mirror is open (src/tui/screens/readgrants.ts):agrants an app,ca crew member,xrevokes. - Lists: an ungranted or revoked app's token never sees the mirror in
/api/v1/repos, search or explore (canReadand the visibility SQL ask the app's grant), and its search leaves out the owner's connected-origin catalog. - Try it: connect an origin read-only, mirror a repository, open its settings, grant
morning-paper, thencurl -H "authorization: Bearer $FORGE_TOKEN" $FORGE_URL/api/v1/repos/<owner>/<name>/commitswith that app's token. - Tests:
test/origin-read-grant.test.ts.