Repository navigation
feat(auth): add read-only viewer role for fleet inspection and console - #1809
Draft
bheemreddy-samsara wants to merge 1 commit into
Draft
bheemreddy-samsara wants to merge 1 commit into
bheemreddy-samsara wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
bheemreddy-samsara
force-pushed
the
bheemreddy-samsara/viewer-role
branch
from
November 23, 2026 21:58
b1a5cea to
dc1416c
Compare
Add a read-only `viewer` token and daemon session role so console users
and monitoring scripts can inspect fleet state, events, usage, redacted
configuration and live device screens without full `operator` (`admin`)
privileges.
- Model daemon roles as a lattice (`agent`, `viewer`, `admin`) with
`OperationRole = Role | "any"`, `roleAllows`, and `readsEveryLease` in
`src/contract/roles.ts`; bump `PROTOCOL_VERSION_RANGE` to `103`.
- Keep all mutating operations, lease mutations, `device.exec`,
`driver.passthrough`, `doctor.run`, `cleanup.run`, and
`config.get { showSecrets: true }` refused (`FORBIDDEN`) for `viewer`.
- Require explicit `"read" | "hold"` access on `findOwnedLease` so
holder-only sub-routes (`GET /v1/leases/{id}/events`,
`/v1/leases/{id}/files*`, and module lease routes without
`viewerLeaseRoute: true`) refuse `viewer` with `403` before calling
`lease.get`; opt `stream` in via `viewerLeaseRoute` and share
`readsEveryLease` across worker/gateway stream links with exhaustive
role mapping.
- Migrate SQLite `tokens` table from v2 to v3 to accept `viewer` tokens
while preserving row order, worker pins, and `tokens_worker_id`.
- Allow `viewer` tokens in `simlock token create --role viewer` and the
web console, gating mutating menus/writes centrally in `useActions()`
(and filtering search palette actions) while showing `Read-only` in
the sidebar when `identity.role === "viewer"`.
- Record ADR 0090, update narrowed ADR statuses, module manuals, OpenAPI
route roles, and website docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
bheemreddy-samsara
force-pushed
the
bheemreddy-samsara/viewer-role
branch
from
November 23, 2026 23:56
dc1416c to
e851771
Compare
This was referenced Nov 24, 2026
This branch has not been deployed
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.
Summary
Add a read-only
viewertoken and daemon session role so web console users and monitoring scripts can inspect fleet state, events, usage, redacted configuration and live device screens without fulloperator(admin) privileges.Workflow
What changed
102 -> 103): Modeled roles as a lattice (agent,viewer,admin) withOperationRole = Role | "any",roleAllows, andreadsEveryLeaseinsrc/contract/roles.ts. Moved fleet reads (worker.list,list.get,events.*,usage.get,inbox.get,token.list, redactedconfig.get) to"viewer"and shared reads (identity.get,catalog.get,status.get,lease.list,lease.get,component.list,baseline.list) to"any". Kept all mutations, lease ops,device.exec,driver.passthrough,doctor.run,cleanup.run, andconfig.get { showSecrets: true }refused forviewer.viewertoTokenRole,Identity,resolveHelloRole, andsimlock token create --role viewer; migratedtokenstable v2 -> v3 preserving row order,STRICT,hash UNIQUE,worker_id, andtokens_worker_id.toRole; required"read" | "hold"onfindOwnedLease(refusingviewerwith403on/files,/events,/input,/tunnel, and default-deny module lease routes; onlystreamopts in viaviewerLeaseRoute: true); exhaustive stream role mapping sharingreadsEveryLease.viewertokens into the console, gated mutating menus/writes centrally inuseActions()(plus search palette filtering), and displayedRead-onlyin the sidebar.http.proxyAuth) is deferred to a follow-up PR so SSO operators keep an elevation path.Validation
Head:
e8517712e2e/physical-reclaim.test.ts:315(expected 'ready' to be 'quarantined'); passes 8/8 locally and passed in CI onb1a5ceae(identical code). Needs a maintainer rerun ofE2E (1/3)to clearQuality.