Repository navigation
fix(operators): reject operators on encrypted attributes (7.4.x) - #1012
Merged
Merged
Conversation
Backport of #1011 to 7.4.x. An operator runs in the adapter on the stored value, which for an attribute with the encrypt filter is the ciphertext, so a stringReplace rewrote the envelope and the value could no longer be decrypted. The operator validator now refuses any operator on an encrypted attribute.
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?
Backport of #1011 to
7.4.x, for a 7.4.2 release that Appwrite can take without moving to 8.x.An operator runs in the adapter on the stored value. For an attribute with the
encryptfilter that value is the ciphertext envelope, sostringReplace('a', 'o')rewrote the envelope itself and the value could no longer be decrypted.Validator\Operatornow refuses any operator on an attribute with theencryptfilter withCannot apply <method> operator to encrypted attribute '<key>', and the write throwsException\Structurebefore anything is written.Test Plan
testOperatorEncryptedAttributeinOperatorTestsfails on 7.4.1 against PostgreSQL 18 and passes with this change on PostgreSQL and SQLite.--filter OperatoronPostgresTest: 94 of 95 pass.testEmptyOperatorValuesfails on 7.4.1 too under that filter, because it depends on a collection another test creates.phpstan analyse --level 7 src testspass.Related: appwrite/appwrite#14218