Skip to content

feat(sharing): registered subject providers; built-in user and tenant_role recipients (#963) - #1039

Merged
antosubash merged 3 commits into
mainfrom
feat/sharing-subjects-963
Nov 18, 2026
Merged

antosubash merged 3 commits into
mainfrom
feat/sharing-subjects-963

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

  • Sharing recipients are no longer users only. Modules register subject providers through sharing.contracts. Each provider validates a subject id for the sharer (active tenant, same enumeration protections as users), supplies masked or batched labels, and supplies a membership predicate that stays inside the single policy SQL query. Closes sharing: recipients are users only (no group/team subject types) #963
  • Built-in providers:
    • user: today's behaviour, unchanged; a grant request without subject_type still means a user.
    • tenant_role: shares with everyone who holds a role in the active tenant. A role change takes effect on the next request, and a grant in tenant A never applies in tenant B.
  • Unknown or unregistered subject types are refused at grant time, and existing rows of such a type grant nothing (fail closed).
  • API: subject_type on grants, GET /api/sharing/subject-types, and typed /candidates. Role search matches ids and the request-locale label, ignoring case and diacritics, so Eigentumer finds Eigentümer. api.generated.ts is regenerated.
  • ShareDialog and useShares show a translated type switch when more than one provider is registered.
  • The principal carries the active-tenant roles that tenant_role grants use. HTTP and principal_for (No way to build a user's principal outside a request (worker, token-authenticated feed) #1005) still produce identical principals, and a warm request adds no queries.
  • docs/modules/sharing.md (provider API and example), CHANGELOG. No migration.

Verification

  • No host page or installed module registers a shareable resource type yet, so the dialog can't be exercised end to end in the running app and there are no screenshots. Coverage comes from the sharing HTTP suite (290 tests with tenants) and the dialog's Vitest tests.
  • Review: 3 passes.
  • Local CI: make lint ✓, make test-js 976 passed, make test-py 9179 passed. After rebasing onto modules: declare an admin surface and permissions once #988: lint ✓, and the overlapping suites (sharing, tenants, users, api_tokens, permissions, core, hosting, host) passed, 4063 tests.

Test plan

  • CI is green

https://claude.ai/code/session_01FXHA3Zj78w6GWaNKoovHq6

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: cbe8c46
Status: ✅  Deploy successful!
Preview URL: https://aba670f6.simple-module-python.pages.dev
Branch Preview URL: https://feat-sharing-subjects-963.simple-module-python.pages.dev

View logs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-18T18:49:47.812602Z cbe8c46 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@antosubash antosubash added the shipped /ship passed on the head commit label Nov 18, 2026
@antosubash

Copy link
Copy Markdown
Owner Author

/ship passed on cbe8c46
Rounds: 1 of 3
Review: 3 passes; pass 1 (security: principal parity with #1005, tenant scoping, revocation, fail-closed, single query) found 1 (role search ignored localized labels), pass 2 found 1 (no diacritic folding), both fixed with en/de tests; pass 3 clean.
QA: no host page or installed module registers a shareable resource type, so no live dialog run; covered by the sharing HTTP suite and the dialog Vitest tests (stated in the PR).
Local CI: make lint ✓, make test-js 976 passed, make test-py 9179 passed; after rebasing on #988: lint ✓ and overlapping suites 4063 passed.
CI: PR checks SUCCESS

@antosubash
antosubash merged commit 453932f into main Nov 18, 2026
19 checks passed
@antosubash
antosubash deleted the feat/sharing-subjects-963 branch November 18, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shipped /ship passed on the head commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sharing: recipients are users only (no group/team subject types)

1 participant