Repository navigation
fix(deployments): read downloads through the handle that was checked - #15022
Conversation
Downloads checked the local artifact path and then reopened it for every chunk, so a build could swap the file in between. The file is now opened once, kept only when the opened file is the one at the checked path, and every range and chunk is read from that handle.
|
Review complete. No issues found — approved ✅. The change closes a TOCTOU window in deployment downloads: instead of re-reading by path after the safety check, local artifacts are opened once and validated against the path via
Reviewed commit: e4f9ac5 |
🟢 Tier S · Ready to mergeLocal deployment downloads open a validated artifact once and use that stream for range and chunk reads, preventing path swaps between checks and reads. Function and Site handlers retain device-based reads for non-local storage. A unit test covers artifact validation and reading the opened file after its path is replaced. Latest changes: The newest commit imports
📂 Walkthrough · 4
Reviewed the commits since |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Downloads checked the local artifact path and then reopened it for every chunk, so a build could swap the file in between. The file is now opened once, kept only when the opened file is the one at the checked path, and every range and chunk is read from that handle.
Lint, PHPStan and the touched unit tests passed locally before rebasing on main; e2e runs in CI.
Related: appwrite-labs/cloud#6673