Replies: 3 comments
-
Note: it's best to report vulnerabilities directly to the Payload team so they can resolve the defect prior to public disclosure. @WilsonLe Can you provide a link to a reproduction? Can this be reproduced in one of the test suites?
The test suites do need some work regarding regression - they not cover all documented features or reported defects. This is an area I'd like to contribute to. If you have written more comprehensive test, perhaps they can be added to the repo? |
Beta Was this translation helpful? Give feedback.
-
I haven't tried to reproduce this yet though it makes sense conceptually. My question would be what should happen if a user tries to update a document where access to a later draft would be limited. This doesn't allow for the most up to date changes to be merged with the data being saved. How would we handle this without it looking like a bug that causes data loss between users with different access privileges? Also, should getlatestdraft invoke the read or update access method? I think the way we have it is likely not going to change and perhaps documenting it as you said is the only way forward. I'm interested in other feedback. |
Beta Was this translation helpful? Give feedback.
-
Since this needs a wider discussion/feedback, I'm converting this to a discussion |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Undocumented caveat that might lead to access control vulnerability.
In collections with draft and version enabled,
update
access control needs to handle both cases where user is updating by ID or performing bulk updates (in other words, whether or notargs.id
is defined).If the user's access control does not handle cases where
args.id
is defined, only returning query constraints, assuming that returning query constraints is sufficient to handle bothupdateById
and bulkupdate
(which is true for non-draft and non-versioned collection), then there's a vulnerability: user can bypass the update access control byupdateById
, (i.e. `PATCH /api/pages/page-id).Users can bypass the update access control because when user specifies an
id
in their update request, the implementation of getLatestCollectionVersion.ts, with version and draft enabled collections, Payload naively finds the latest version of the to-be-updated document without regarding to access control, and naively return the latest version without considering access control.Of course, this vulnerabilty can be negated if developers handles cases where
args.id
is defined, but that's not always the case. This caveat is not documented anywhere. The only reasons I came accross this weird caveat is having robust test cases.Edit: this caveat also applies for delete access control of draft & version enabled collections
Beta Was this translation helpful? Give feedback.
All reactions