Repository navigation
feat: add base access control - #17662
Merged
Merged
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
GermanJablo
marked this pull request as ready for review
August 5, 2026 22:53
GermanJablo
requested review from
JarrodMFlesch and
jacobsfletch
as code owners
August 10, 2026 16:25
Contributor
Author
Multi-tenant is addressed in #17739; e-commerce was evaluated but is not a good fit because its access rules are collection-specific |
paulpopus
requested changes
Aug 12, 2026
Resolve sanitize.spec.ts conflict, reject non-boolean baseAccess admin results, and fail closed per operation in getEntityPermissions so one misconfigured access callback cannot break the full permissions response.
Invalid baseAccess create config should fail loudly during permission resolution instead of being converted to denied access.
The merge with main kept both the exported generic GlobalAccess and the local one it replaced, breaking the build with TS2395.
Base access now wraps readVersions whenever versions are enabled, so the sanitized defaults test from main no longer applies unchanged.
paulpopus
approved these changes
Aug 12, 2026
GermanJablo
added a commit
that referenced
this pull request
Aug 12, 2026
Uses the `baseAccess` API from #17662 to centralize the multi-tenant plugin's tenant constraints instead of replacing six access callbacks on every collection. Payload now selects the tenant policy by `slug` and combines it with document-specific access in core. Existing base policies are preserved, while the legacy wrapper remains only for `accessResultOverride`, which needs the original document result. This removes two composition helpers and 40 lines of production code without changing existing access behavior. Stacked on #17662. Co-authored-by: German Jablonski <[email protected]>
r1tsuu
added a commit
that referenced
this pull request
Aug 13, 2026
Resolved conflicts in the 11 read operations that main touched via feat: add base access control (#17662) and the sort-validation change: kept main's `slug` argument to executeAccess and the new validateSortQuery calls, applied on top of this branch's removal of the outer try/catch + killTransaction wrapper.
jmikrut
added a commit
that referenced
this pull request
Aug 14, 2026
Resolved one conflict in `updateByID`, taking main's base access control (#17662) which passes the entity slug into every access check. Three things the merge broke silently and needed fixing: - the merge preflight called access functions without `slug`, now required - `updateGlobal`'s branch-copy write passed a third argument to `Model.create`, which selects a different overload under Mongoose 9 (#17747) - `payload` and `translations` dist were stale, so `ui` could not see main's new clipboard keys or the `slug` access argument Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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
Adds a top-level
baseAccessconfig with separatecollectionsandglobalsaccess maps. This gives applications and plugins one core-owned policy layer without iterating over resources or hardcoding Payload-managed slugs.Motivation
This originated from Figma Make's need to enforce a read-only policy for viewer users across every Payload resource. Its plugin currently has to find resources and wrap their access callbacks, which is order-dependent and can miss Payload-managed resources created during sanitization.
Plugins can currently apply a shared policy only by finding every Collection and Global and wrapping each access callback. That is order-dependent and can miss resources added by later plugins or by Payload during sanitization, making omissions difficult to detect and potentially security-sensitive.
baseAccessmoves that composition into Payload so the same policy is applied consistently to configured, plugin-provided, and Payload-generated resources.Alternatives considered
Whereconstraints supported by existing Collection and Global Access Control.Changes
CollectionAccessandGlobalAccessdirectly forbaseAccess.collectionsandbaseAccess.globalsslugto all Collection and Global Access Control callback arguments, includingaccess.adminoverrideAccessbehavior and existing resource-specific accessbaseAccessout of the client config