Skip to content

fix(operators): reject operators on encrypted attributes (7.4.x) - #1012

Merged
HarshMN2345 merged 1 commit into
7.4.xfrom
fix-encrypted-operators-7.4
Oct 13, 2026
Merged

HarshMN2345 merged 1 commit into
7.4.xfrom
fix-encrypted-operators-7.4

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

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 encrypt filter that value is the ciphertext envelope, so stringReplace('a', 'o') rewrote the envelope itself and the value could no longer be decrypted. Validator\Operator now refuses any operator on an attribute with the encrypt filter with Cannot apply <method> operator to encrypted attribute '<key>', and the write throws Exception\Structure before anything is written.

Test Plan

  • New testOperatorEncryptedAttribute in OperatorTests fails on 7.4.1 against PostgreSQL 18 and passes with this change on PostgreSQL and SQLite.
  • --filter Operator on PostgresTest: 94 of 95 pass. testEmptyOperatorValues fails on 7.4.1 too under that filter, because it depends on a collection another test creates.
  • Pint and phpstan analyse --level 7 src tests pass.

Related: appwrite/appwrite#14218

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.
@HarshMN2345
HarshMN2345 merged commit 2bbc6f0 into 7.4.x Oct 13, 2026
3 checks passed
@HarshMN2345
HarshMN2345 deleted the fix-encrypted-operators-7.4 branch October 13, 2026 08:13
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