Repository navigation
fix: add missing deployment ownership check in status update endpoints - #11868
yogeshwaran-c wants to merge 1 commit into
Conversation
The deployment status update (cancel build) endpoints for both functions and sites did not verify that the deployment belongs to the specified function or site. The corresponding Get and Delete deployment endpoints already perform this check via resourceId comparison. Without this check, a deployment from a different function/site could be canceled using a mismatched parent resource ID.
Greptile SummaryThis PR adds the missing deployment ownership check ( Confidence Score: 5/5Safe to merge — minimal, targeted fix with no side effects. Both changes exactly mirror the check already present in the Get and Delete endpoints for the same resources. No new logic is introduced; the fix simply closes an authorization gap on the PATCH path. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix: add missing deployment ownership ch..." | Re-trigger Greptile |
Functions and Sites status-update (cancel) endpoints fetched a deployment by ID without verifying it belonged to the function/site in the URL path. A caller with write access on one resource could cancel a build belonging to another. Match Get/Delete/Download by rejecting with DEPLOYMENT_NOT_FOUND when resourceId does not match. Supersedes the stale appwrite#11868 approach with a rebased fix. Co-authored-by: Chirag Aggarwal <[email protected]>
|
Closing as stale since there has been no activity for a while. Thanks for the contribution! If this is still relevant, feel free to rebase on |
Summary
PATCH /v1/functions/:functionId/deployments/:deploymentId/statusandPATCH /v1/sites/:siteId/deployments/:deploymentId/statusendpoints did not verify that the deployment belongs to the specified function/siteGETandDELETEdeployment endpoints already perform this check ($deployment->getAttribute('resourceId') !== $function->getId()), so this was an oversight in the status update endpointsTest plan