Skip to content

fix(deployments): require ownership on chunked upload resume - #13118

Merged
ChiragAgg5k merged 2 commits into
mainfrom
fix/deployment-upload-resume-ownership-v2
Aug 6, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
fix/deployment-upload-resume-ownership-v2

Conversation

@cursor

@cursor cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

POST .../deployments with content-range + x-appwrite-id loads an existing deployment to resume a chunked upload (or short-circuit when already complete) without checking that it belongs to the function/site in the URL.

Adds resourceId + resourceType guards in both Functions and Sites Deployments/Create (both lock callbacks). E2E coverage uses content-range so x-appwrite-id is honored.

Replaces #13117 (CI stuck on that branch after intermediate commits; Greptile was already 5/5).

Test Plan

  • E2E Functions + Sites: resume under foreign resource with content-range + x-appwrite-id → 404 deployment_not_found
  • CI Functions / Sites e2e

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?
Open in Web View Automation 

Reject createDeployment resume via content-range + x-appwrite-id when
the deployment belongs to another function/site or resource type.
Adds Functions and Sites e2e coverage.

Co-authored-by: Chirag Aggarwal <[email protected]>
@cursor
cursor Bot marked this pull request as ready for review August 6, 2026 04:13
@cursor
cursor Bot requested a review from ChiragAgg5k August 6, 2026 04:14
@greptile-apps

greptile-apps Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents chunked deployment uploads from being resumed or short-circuited through a different Function or Site.

  • Validates both the deployment resource ID and resource type in the pre-upload and post-upload lock callbacks.
  • Adds Functions and Sites end-to-end coverage for foreign-resource resume requests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php Adds Function ownership and resource-type validation around both existing-deployment lookup stages.
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php Adds equivalent Site ownership and resource-type validation around both upload lock callbacks.
tests/e2e/Services/Functions/FunctionsCustomServerTest.php Adds completed and partial chunked-resume ownership scenarios for Function deployments.
tests/e2e/Services/Sites/SitesCustomServerTest.php Adds foreign-resource chunked-resume coverage for Site deployments.

Reviews (2): Last reviewed commit: "test(functions): cover partial chunked u..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/deployment-upload-resume-ownership-v2 (after).

Metric Before After Change
🚀 Requests/sec 206.25 205.71 ⚪ -0.3%
⏱️ Latency P50 69.72 ms 68.72 ms ⚪ -1.4%
⏱️ Latency P95 239.39 ms 250.77 ms ⚪ +4.8%
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 68.72 250.77 12,768 205.71 +11.38
Account 132.83 336.91 672 11.16 -5.05
TablesDB 65.92 227.87 6,944 113.42 +5.61
Storage 62.62 226.47 3,360 56.84 -3.63
Functions 105.78 303.21 1,792 30.97 +9.56

Top API waits (after)

API request Max wait (ms)
account.name.update 999.74
storage.files.download 793.08
tokens.update 774.27
storage.buckets.create 742.46
functions.runtimes.list 703.69

Exercise a foreign-function resume against an incomplete multi-chunk
deployment so the ownership guard is not only covered via the completed
short-circuit path.

Co-authored-by: Chirag Aggarwal <[email protected]>
@ChiragAgg5k
ChiragAgg5k merged commit 32d3984 into main Aug 6, 2026
44 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/deployment-upload-resume-ownership-v2 branch August 6, 2026 11:17
ChiragAgg5k added a commit that referenced this pull request Aug 6, 2026
Keep the partial-resume ownership test landed via #13118.

Co-authored-by: Cursor <[email protected]>
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.

2 participants