{{ message }}
Repository navigation
fix(events): check row and document actions against their own level - #14742
Open
callmegautam wants to merge 2 commits into
Open
callmegautam wants to merge 2 commits into
callmegautam wants to merge 2 commits into
Conversation
2 tasks done
Contributor
This branch has not been deployed
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 does this PR do?
Fixes function and webhook subscriptions to row/document
upsertevents, which were rejected with400 general_argument_invalid("Event is not valid").For a 7-part pattern such as
tablesdb.*.tables.*.rows.*.upsert,Event::isValid()reads the action from$parts[6]but looked it up one level too high, in$events[$type][$subType](thetables/collectionslevel).create,updateanddeletepassed only because that level has actions with the same names.upsertexists only underrows/documents, so every row or document upsert subscription was refused.The validator now checks the action against
$events[$type][$subType][$subSubType]when the pattern has a sub-sub resource. 3-part and 5-part patterns are unchanged.Test Plan
tests/unit/Event/Validator/EventValidatorTest.php:tablesdb.*.tables.*.rows.*.upsert,tablesdb.books.tables.chapters.rows.*.upsert,databases.*.collections.*.documents.*.upsert,databases.books.tables.chapters.rows.prolog.upsert,documentsdb.*.collections.*.documents.*.upsert,vectorsdb.*.collections.*.documents.*.upserttablesdb.*.tables.*.upsert(upsert is not a table action),tablesdb.*.tables.*.rows.*.unknownvendor/bin/phpunit tests/unit/Eventpasses (46 tests, 413 assertions)pint --testpasses on both filesphpstan analyse src/Appwrite/Event/Validator/Event.phpreports no errorsRelated PRs and Issues
tablesdb.*.tables.*.rows.*.upsert("Event is not valid") #14653upsertto the events config)Checklist