Skip to content

feat: set-only identity + surface-privilege authz (major) - #167

Merged
patrickleet merged 5 commits into
tasks--graphql-qs-epicfrom
tasks--graphql-qs-surface-authz-1
Jul 31, 2026
Merged

feat: set-only identity + surface-privilege authz (major)#167
patrickleet merged 5 commits into
tasks--graphql-qs-epicfrom
tasks--graphql-qs-surface-authz-1

Conversation

@patrickleet

Copy link
Copy Markdown
Collaborator

Summary

Implements [[tasks/graphql-qs-surface-authz-1]] on top of tasks--graphql-qs-epic (post multi-role surfaces).

Breaking: identity is the x-roles set only — no priority-picked primary x-role. Execution context is the named application surface privilege (or membership-checked role surface). Multi-role requests without a named surface fail closed. Anonymous surfaces open with empty asserted roles when eligible includes anonymous.

Changes

  • Claim map: set x-roles only; remove role_priority primary pick
  • resolve_execution_authority + ExecutionAuthority request data for compile/live
  • Protocol/cacheScope v2: privilege pack + asserted set (not primary role)
  • Causal command grants: any asserted role ∩ command roles
  • e2e-ui: e2e-ui-public anonymous surface; suite graphql() auto-selects e2e-ui vs e2e-ui-admin
  • Specs: identity / authorization / client-compiler

Local verification

  • cargo test -p distributed --features graphql,sqlite --lib client_surface_parity (23 ok)
  • cargo test -p distributed --features graphql,sqlite --test graphql_identity (23 ok)
  • cargo test -p e2e-suite --test behavioral (18 ok)
  • Playwright live stack not run in agent env (offline + unit are the gate)

Test plan

  • Unit: multi-role surface open, multi-role without surface rejected, anonymous surface, set-only claims
  • Offline e2e suite green
  • CI full matrix on PR

Breaking major-release cutover: Session carries x-roles only (no
priority-picked primary x-role). GraphQL execute/stream binds to the opened
application surface privilege pack (or a membership-checked role surface).
Multi-role principals without a named surface fail closed. Anonymous
eligible surfaces open with empty identity.

e2e-ui: public e2e-ui-public surface, dual-role admin suite uses admin
surface for elevated ops, causal grants check any asserted role.

Implements [[tasks/graphql-qs-surface-authz-1]]
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 88b960f0-60a3-4cd8-b8fb-b936349a59ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Add service test that opens e2e-ui-public with an empty Session and queries
chat_messages, plus unauthenticated /public route documenting the bare
protocol path. Specs no longer teach Session::role()/x-role as execution.

Implements [[tasks/graphql-qs-surface-authz-1]]
- graphql_query_protocol: use role binding for x-roles header; WS
  connection_init sends x-roles (not x-role)
- graphql_oidc_common E1: assert Session::roles() instead of role(),
  which is None under set-only claim mapping

Implements [[tasks/graphql-qs-surface-authz-1]]
Major-release identity is x-roles only; drop migration paths that still
accepted or re-injected a singleton primary role.

- ROLE_KEY is x-roles; Session::roles/has_role are the identity API
- remove causal ensure_causal_grant legacy x-role fallback
- schema/metrics privilege fallback uses roles set only
- OIDC e2e layer re-injects x-roles (not x-role + default user)
- JS DevHeaders + tests send x-roles
- keep stripping client x-role as defense-in-depth only

Implements [[tasks/graphql-qs-surface-authz-1]]
Unconfigured singleton roles fail closed at execution-authority resolve
(same generic surface message), not via legacy primary-role schema lookup.

Implements [[tasks/graphql-qs-surface-authz-1]]
@patrickleet
patrickleet merged commit a5be455 into tasks--graphql-qs-epic Jul 31, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant