Repository navigation
fix(databases): scope list cache to collection permissions and gate inline encryption - #14791
Conversation
…nline encryption Cached list responses were keyed on schema, roles and queries only, so a change to collection permissions or documentSecurity kept serving the old entries until the TTL expired. Fold both into the cache field. Inline attributes and columns could carry the encrypt filter without the plan check or minimum size the dedicated string endpoints enforce. Apply the same checks when creating a collection or table with inline definitions.
|
Review complete. 🟠 1 high 💬 Inline comments (1)
The change introduces an encrypt attribute filter with plan gating and size validation at collection-create time, plus compensating cleanup when validation fails, and extends the list-cache field hash to include collection permissions and documentSecurity so authorization changes take effect immediately. E2E coverage in DatabasesBase exercises the new paths.
Reviewed commit: 006fa8f |
🟢 Tier S · Ready to mergeList-response cache keys now include collection permissions and document security, so changes to either invalidate cached responses. Inline encrypted attributes and columns receive the plan and minimum-size checks used by dedicated endpoints, with rejected collection creation cleaned up; E2E coverage exercises permission-sensitive cache misses and undersized encrypted definitions. Latest changes: The newest commits make inline encryption detection recognize keyed filter maps using the same loose matching as attribute responses, and add an E2E regression for that input shape.
📂 Walkthrough · 5
Reviewed the commits since |
There was a problem hiding this comment.
This PR adds encrypted string attribute/column support gated by plan entitlement in collection creation, and busts the list cache on permission/documentSecurity changes across the Databases, DocumentsDB, and TablesDB Create actions.
Key findings
- 🟠 Non-canonical
filtersshapes bypass encrypt gates — Create.php:165
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
The attributes validator accepts filters that are not a plain list of strings, and the attribute response filter reads encrypt with a loose match, so the inline checks have to read it the same way to apply to every accepted shape.
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
…nline encryption (backport #14791) The list cache key ignored collection permissions and documentSecurity, so a permission change kept serving cached lists until the TTL ran out. Inline encrypted attributes on create collection/table skipped the plan gate and minimum size the dedicated string endpoints apply. (cherry picked from commit db6ea18)
…nline encryption (backport #14791) The list cache key ignored collection permissions and documentSecurity, so a permission change kept serving cached lists until the TTL ran out. Inline encrypted attributes on create collection/table skipped the plan gate and minimum size the dedicated string endpoints apply. (cherry picked from commit db6ea18)
…nline encryption (backport #14791) The list cache key ignored collection permissions and documentSecurity, so a permission change kept serving cached lists until the TTL ran out. Inline encrypted attributes on create collection/table skipped the plan gate and minimum size the dedicated string endpoints apply. (cherry picked from commit db6ea18)
…che-and-inline-encrypt fix(databases): scope list cache to collection permissions and gate inline encryption (cherry picked from commit db6ea18)
What
$permissionsanddocumentSecurity. Changing either takes effect on the next list call instead of after the cached TTL, without needingpurge=true.encryptfilter now applies the same checks as the dedicated string endpoints: thedatabasesAllowEncryptplan gate (no-op without a plan, as on self-hosted) and theAPP_DATABASE_ENCRYPT_SIZE_MINminimum size. The half-created collection is removed on rejection, as with the other inline validation failures.planis now injected into the legacy, TablesDB and DocumentsDB create actions.Tests
DatabasesBase::testListDocumentsCacheBustedByPermissionChange: miss, hit, then a permissions-only update gives a miss, and a documentSecurity-only update gives a miss.DatabasesBase::testCreateCollectionInlineEncryptedStringTooSmall: an inline encrypted string below the minimum size returns 400 and no collection is left behind.Attributes/String/Create.php.E2E was not run locally (shared machine); relying on the CI e2e lanes. Pint, PHPStan and Rector pass for the touched files.
Related: appwrite-labs/cloud#6666