feat!: respect access control by default in Local API - #17686
Open
nathanlentz wants to merge 2 commits into
Open
feat!: respect access control by default in Local API#17686nathanlentz wants to merge 2 commits into
nathanlentz wants to merge 2 commits into
Conversation
BREAKING CHANGE: Local API calls now default overrideAccess to false. Set overrideAccess: true to preserve access-bypassing behavior.
nathanlentz
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
August 6, 2026 18:12
This was referenced Aug 6, 2026
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.
What?
This changes the Local API to respect access control by default.
overrideAccessnow defaults tofalseconsistently across collection, global, auth, and jobs operations.This is a breaking change. A Local API call without
overrideAccesswill no longer automatically bypass access control.Before:
After:
To intentionally keep the previous behavior:
To run the operation as a user:
The PR also adds a codemod that preserves existing application behavior by adding
overrideAccess: trueto Local API calls it can identify safely:npx @payloadcms/codemod . --transform add-override-access-trueThe codemod keeps existing explicit values and reports calls that need manual review.
Why?
Passing a user to a Local API operation should cause that user's access rules to be respected unless the caller explicitly chooses to bypass them. The previous default made user-scoped calls easy to get wrong and was especially confusing because the supplied user could be ignored for access checks.
How?
overrideAccess: falseacross Local API operations.overrideAccess: true.add-override-access-truemigration codemod.Stack
Documentation will follow separately after the enterprise plugins are updated.
Related: PYLD-2327