fix: allow docker compose command chaining - #4997
Open
ews-pgasser wants to merge 4 commits into
Open
Conversation
Author
|
@Siumauricio @narcisonunez please check this PR, we urgently need the docker compose command chaining feature back and there is no possibility to downgrade versions too. |
Collaborator
|
Add tests (compose-command-injection.test.ts) |
Author
✅ done, both succeded properly @narcisonunez Biome Check ( Tests ( |
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 is this PR about?
This PR updates the
sanitizeCommandlogic to safely allow&&chaining in custom compose deployment commands. Currently, the strict blocklist on&prevents users from executing standard multi-step deployments (such ascompose pull && docker compose down && docker compose up -d --build). This is critical for stacks that require full teardowns to clear in-memory caches (e.g., Redis) or sync volume mounts during image updates. The updated logic blocks single&(backgrounding) and strictly enforces that any chained command must securely start withdocker composeordocker-compose, maintaining security while unblocking legitimate DevOps workflows.Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #4992
Screenshots (if applicable)
Greptile Summary
This PR permits guarded
&&chaining in custom Docker Compose deployment commands while continuing to reject unsafe shell metacharacters and non-Compose chain segments.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Reviews (3): Last reviewed commit: "chore: add tests" | Re-trigger Greptile
Context used: