Skip to content
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

Escape parentheses in shJoin #6101

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

briandealwis
Copy link
Member

Fixes: #6100

Description
In skaffold debug, we rewrite container command-lines to run under the applicable language runtime debugger. We support "sh -c"-style command-lines that result from Dockerfile RUN command args by splitting and then re-joining the command-lines. Our re-joining helper tries to do minimal escaping, escaping only whitespace and a double-quote. But command-lines such as [Bank of Anthos's contacts] container then fail as they include parentheses, which are interpreted by the shell:

gunicorn -b :$PORT --threads 4 --log-config /logging.conf --log-level=$LOG_LEVEL "contacts:create_app()"

This PR causes our re-join to quote parentheses, brackets, and braces, and single-quotes too.

This quoting is imperfect as we don't track information such as the contacts:create_app() being quoted.

@briandealwis briandealwis requested a review from a team as a code owner June 28, 2021 21:53
@briandealwis briandealwis requested a review from gsquared94 June 28, 2021 21:53
@google-cla google-cla bot added the cla: yes label Jun 28, 2021
@briandealwis briandealwis enabled auto-merge (squash) June 28, 2021 22:00
Copy link
Contributor

@MarlonGamez MarlonGamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov
Copy link

codecov bot commented Jun 28, 2021

Codecov Report

Merging #6101 (2669b16) into master (044c65f) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6101      +/-   ##
==========================================
- Coverage   70.19%   70.18%   -0.02%     
==========================================
  Files         475      475              
  Lines       18156    18156              
==========================================
- Hits        12745    12743       -2     
- Misses       4475     4476       +1     
- Partials      936      937       +1     
Impacted Files Coverage Δ
pkg/skaffold/debug/transform.go 90.17% <100.00%> (ø)
pkg/skaffold/util/tar.go 50.66% <0.00%> (-5.34%) ⬇️
pkg/skaffold/docker/parse.go 87.14% <0.00%> (+0.95%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 044c65f...2669b16. Read the comment docs.

@briandealwis briandealwis merged commit 7b496d2 into GoogleContainerTools:master Jun 28, 2021
@briandealwis briandealwis deleted the i6100 branch June 28, 2021 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python debugging entrypoint rewrite incorrect if it contains parenthesis.
2 participants