Skip to content

fix(storage): list local directory entries by literal name - #15033

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/storage-literal-names
Oct 27, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/storage-literal-names

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Local scanned directories with glob, so an entry named like a pattern (such as *) expanded into its siblings, including symbolic links, and recursive deletes reached files outside the directory. Entries also skipped names starting with two dots. Directories are now listed with scandir.

Lint, PHPStan and the touched unit tests passed locally before rebasing on main; e2e runs in CI.

Related: appwrite-labs/cloud#6674

Local scanned directories with glob, so an entry named like a pattern (such
as *) expanded into its siblings, including symbolic links, and recursive
deletes reached files outside the directory. Entries also skipped names
starting with two dots. Directories are now listed with scandir.
@luxor-code-review

luxor-code-review Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR reworks how the local storage device enumerates directory entries during recursive path deletion, replacing glob pattern matching with literal entry names from scandir so that filenames containing glob metacharacters no longer match unintended sibling paths, and adds unit tests covering literal-name deletion, glob-character filenames, and symlink handling.

Files Change
packages/storage/src/Device/Local.php Switches deletePath recursion from glob() to scandir()-based literal-name iteration, avoiding pattern expansion of user-controlled filenames.
packages/storage/tests/Device/LocalTest.php Adds tests asserting literal deletion behavior for glob-metacharacter names, hidden entries, and symlinks outside the deleted tree.

One domain scan (filesystem-operations) did not publish output; its checklist was substantially overlapped by the correctness, security, and holistic scans, which all completed.

Reviewed commit: fec0120

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 27, 2026
@ghost

ghost commented Oct 27, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The literal directory scan fixes the affected recursive deletion behavior, and the added regression test covers the relevant glob-like, hidden-name, and symlink cases.

The local storage directory scanner now uses scandir() and returns literal entry paths, including names that glob patterns previously skipped or expanded. A regression test exercises recursive deletion with glob-like and hidden names alongside a symlink to an outside directory.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
packages/storage/src/Device/Local.php Replaces glob-based directory enumeration with literal scandir() entries and skips only . and ...
packages/storage/tests/Device/LocalTest.php Adds coverage that recursive deletion handles glob-like and double-dot hidden entries without deleting a symlink target.

Reviewed fec0120 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/storage-literal-names (after).

Metric Before After Change
🚀 Requests/sec 182.26 202.71 🟢 +11.2%
⏱️ Latency P50 94.75 ms 86.51 ms 🟢 -8.7%
⏱️ Latency P95 220.59 ms 196.5 ms 🟢 -10.9%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 86.51 196.5 12,540 202.71 -24.09
Account 158.98 297.32 660 11.53 -23.31
TablesDB 82.35 153.88 6,820 114.23 -28.79
Storage 81.94 195.08 3,300 56.44 -0.3
Functions 119.33 221.13 1,760 30.78 -26.48

Top API waits (after)

API request Max wait (ms)
functions.variables.create 513.41
account.name.update 420.53
account.prefs.update 415.42
storage.files.create 400.47
storage.buckets.create 367.26

@ChiragAgg5k
ChiragAgg5k merged commit 546c859 into main Oct 27, 2026
70 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/storage-literal-names branch October 27, 2026 19:20
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