Skip to content

fix: pass data to update access in bulk update operation#16241

Open
fkkehlet wants to merge 1 commit intopayloadcms:mainfrom
fkkehlet:fix/bulk-update-pass-data-to-access
Open

fix: pass data to update access in bulk update operation#16241
fkkehlet wants to merge 1 commit intopayloadcms:mainfrom
fkkehlet:fix/bulk-update-pass-data-to-access

Conversation

@fkkehlet
Copy link
Copy Markdown

What?

Pass bulkUpdateData to executeAccess for the update access check in the bulk updateOperation, matching the existing behavior of updateByIDOperation.

Why?

The bulk updateOperation does not pass data to the update access function, while updateByIDOperation does. This means access functions cannot inspect the incoming update payload during bulk operations, for example, to detect a trash (soft-delete) attempt by checking data.deletedAt.

This is inconsistent: the delete access check in the same function already passes data: bulkUpdateData (line 160), but the update access check (line 133) omits it.

In practice, this breaks collections that set update access based on data — e.g., a form submissions collection that blocks regular edits (update: () => false via plugin defaults) but needs to allow trash operations by checking data.deletedAt.

How?

One-line change in packages/payload/src/collections/operations/update.ts:

-      accessResult = await executeAccess({ req }, collectionConfig.access.update)
+      accessResult = await executeAccess({ data: bulkUpdateData, req }, collectionConfig.access.update)

This matches updateByIDOperation (line 120 in updateByID.ts):

await executeAccess({ id, data, req }, collectionConfig.access.update)

The bulk `updateOperation` does not pass `data` to `executeAccess` for
the update access check, unlike `updateByIDOperation` which does. This
makes it impossible for update access functions to inspect the incoming
data — for example, to detect a trash (soft-delete) attempt by checking
`data.deletedAt`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fkkehlet fkkehlet changed the title fix(payload): pass data to update access in bulk update operation fix: pass data to update access in bulk update operation Apr 10, 2026
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