Skip to content

Escape variables in image entrypoints #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Meallia
Copy link
Contributor

@Meallia Meallia commented May 20, 2025

fixes #1572

During the creation of the docker command to execute the job, the entrypoint arguments were passed to bash surrounded by double quotes.

Bash would then substitute variables (like ${FOO} or $BAR), commands (like $(cmd) and `cmd`) in the context of the gitlab-ci-local process.

By surrounding those arguments with single quotes and escaping them in the strings, bash won't try to do anything fancy with the strings and leave them as-is.

@Meallia Meallia force-pushed the dont-substitute-variables-in-entrypoint branch from d477934 to ab3cdbe Compare May 20, 2025 22:59
@Meallia
Copy link
Contributor Author

Meallia commented May 20, 2025

while doing some more testing, I realized all entrypoint arguments are not properly escaped. putting this back to draft for now.

@Meallia Meallia marked this pull request as draft May 20, 2025 23:15
@Meallia Meallia force-pushed the dont-substitute-variables-in-entrypoint branch from ab3cdbe to 8bbb25b Compare May 20, 2025 23:39
@Meallia Meallia marked this pull request as ready for review May 20, 2025 23:39
Signed-off-by: Jonathan GAYVALLET <jonathan.mael.gayvallet@gmail.com>
@Meallia Meallia force-pushed the dont-substitute-variables-in-entrypoint branch from 8bbb25b to 14b47df Compare May 20, 2025 23:40
@ANGkeith
Copy link
Collaborator

nice, lgtm

@firecow
Copy link
Owner

firecow commented May 24, 2025

@Meallia is this ready?

@Meallia
Copy link
Contributor Author

Meallia commented May 24, 2025

Yes, it's ready.

@firecow firecow merged commit aa531c4 into firecow:master May 25, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable substitution should not happen in the job's entrypoint
3 participants