Repository navigation
fix(functions): reject activating a deployment from another function - #13086
Merged
Merged
Conversation
PATCH /v1/functions/:functionId/deployment fetched deployments by ID without checking resourceId, so a caller with functions.write on one function could activate another function's ready deployment. Match the ownership guard already used by Get/Delete/Download. Co-authored-by: Chirag Aggarwal <[email protected]>
Contributor
Greptile SummaryThe PR prevents a function from activating a deployment owned by another function and adds end-to-end regression coverage.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "test(functions): cover activate-deployme..." | Re-trigger Greptile |
Rejects activating another function's deployment via PATCH /v1/functions/:functionId/deployment and keeps owner activation working. Co-authored-by: Chirag Aggarwal <[email protected]>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
ChiragAgg5k
approved these changes
Aug 4, 2026
Meldiron
approved these changes
Aug 4, 2026
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
PATCH /v1/functions/:functionId/deployment(updateFunctionDeployment) fetched a deployment by ID and only checkedisEmpty()/status === readybefore activating it on the function in the URL path.A caller with
functions.writeon any function could pass adeploymentIdbelonging to a different function and activate that foreign deployment (updatingdeploymentId/deploymentInternalId, rewriting matching platformrules, and flipping the function schedule active flag).Sibling endpoints already reject this with
DEPLOYMENT_NOT_FOUNDwhen$deployment->getAttribute('resourceId') !== $function->getId():Functions/Http/Deployments/Get.phpFunctions/Http/Deployments/Delete.phpFunctions/Http/Deployments/Download/Get.phpThis PR adds the same ownership guard to
Functions/Http/Functions/Deployment/Update.php, placed immediately after the empty check so the error is raised before any mutation.Related open coverage for the same class of bug (do not duplicate those):
Test Plan
PATCH /v1/functions/:functionA/deploymentwith adeploymentIdthat belongs to function B now responds404 deployment_not_foundinstead of switching function A's active deployment.updateFunctionDeployment(e.g.FunctionsBaseactivation helpers) still passes.Related PRs and Issues
Checklist