fix(security): cross-org authorization bypass in server.remove#4874
Merged
Conversation
server.remove deleted a server (and its deployment rows) by caller-supplied serverId without checking it belongs to the active organization, unlike server.one and server.update. An owner/admin of org A could delete org B's server registration. Resolve and compare the server's organizationId before the active-services guard, so cross-org callers are rejected without leaking existence.
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.
Fixes GHSA-3rpx-c3j9-q99x.
Problem
server.removedeleted the server record and its deployment rows using the caller-suppliedserverIdwith no check that the server belongs toctx.session.activeOrganizationId— unlike the siblingserver.oneandserver.update, which do compare. The org check was dropped in8127dc453during the migration towithPermission("server", "delete"), which only enforces the role within the caller's own org, not ownership ofinput.serverId.An owner/admin of org A (self-obtainable on open registration) could delete org B's server registration and deployment history by passing org B's
serverId.haveActiveServicesalso ran before any ownership check, leaking existence/state of cross-org servers.Fix
Resolve the server and compare
organizationIdagainst the active org before the active-services guard, matching theupdatehandler. Cross-org callers now getUNAUTHORIZEDwith no existence leak. (redactServerSshKeywas already applied to the response.)Verification (localhost, two orgs)
serverId→ 401 UNAUTHORIZED, target server row intact.Closes GHSA-3rpx-c3j9-q99x.