Skip to content

RSDK-14415 Authorize user invocations based on user_permissions - #6269

Open
Benjamin Rewis (benjirewis) wants to merge 11 commits into
viamrobotics:mainfrom
benjirewis:perms
Open

RSDK-14415 Authorize user invocations based on user_permissions#6269
Benjamin Rewis (benjirewis) wants to merge 11 commits into
viamrobotics:mainfrom
benjirewis:perms

Conversation

@benjirewis

@benjirewis Benjamin Rewis (benjirewis) commented Jul 27, 2026

Copy link
Copy Markdown
Member

RSDK-14415

What

Enforces the user_permissions section of a machine's auth config as described in the scope.

  • Adds UserPermission, User, and Permission structs to config
  • Adds a userPermsAuthorizer (robot/web/authorization.go) that builds per-user permission tables from the config and enforces them via gRPC unary and stream interceptors

When user_permissions changes, tears down gRPC and WebRTC streams that are no longer permitted.

Why

Motivation from scope:

Our authorization mechanisms are too coarse. For example, an "Owner" of a machine should be able to give access to another user without them being able to see the live feed of every camera on the device. Similarly, a user should be able to get the readings from a base’s sensors without being able to actuate the base itself.

Enforcement semantics:

  • If user_permissions is undefined or empty, no client is restricted (today's behavior)
  • Once defined, users are identified by the API key ID or e-mail they authenticated with. Users without an entry are fully restricted unless a default user is defined; unauthenticated clients are always fully restricted; a user with multiple entries is fully restricted and an error is logged
  • Methods not associated with a single resource (RobotService methods, ListStreams) match only grants under the special _machine resources string
  • Streaming RPCs only get authorized on the stream's first received message

Testing

  • Adds robot/web/authorization_test.go and robot/impl/user_permissions_e2e_test.go

[Description generated by Claude 🤖]

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jul 27, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Aug 12, 2026
@benjirewis Benjamin Rewis (benjirewis) changed the title [wip] Implement permissions RSDK-14415 Authorize user invocations based on user_permissions Aug 13, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Aug 13, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Aug 13, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Aug 13, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Aug 17, 2026
Comment thread go.mod
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
)

replace go.viam.com/api => ../api-gen

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants