-
Notifications
You must be signed in to change notification settings - Fork 504
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
🐛 Refactor Dockerfile validation code to handle here-documents #3774
Conversation
Refactors the `validateDockerfileInsecureDownloads` function to handle Dockerfiles that contain here-documents. This implementation handles the basic use-case, namely shell commands. It does not manage other interpreters that are specified through a she-bang, such as python. Fixes #3335 Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3774 +/- ##
==========================================
- Coverage 75.47% 68.59% -6.89%
==========================================
Files 230 230
Lines 15613 15622 +9
==========================================
- Hits 11784 10716 -1068
- Misses 3103 4252 +1149
+ Partials 726 654 -72 |
The other two missed branches (1 new, 1 old) are actually hard to trigger - at least I couldn't come up with something that triggers a parser error. In the old code, the here-docs triggered that case (and raised a sh level error). But that doesn't occur anymore with the fix. |
…loads() Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution and the tests. Left a small comment about one of them
Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
/scdiff generate Pinned-Dependencies |
What kind of change does this PR introduce?
bug fix
What is the current behavior?
The Pinned-Dependencies check fails on Dockerfiles that use here-documents.
RUN <<EOT1 <<EOT2 pip install --no-deps -e git+https://github.com/username/repo.git@v1.0#egg=package EOT1 curl bla | bash EOT2
=>
What is the new behavior (if this is a feature change)?
Dockerfiles containing here-documents don't cause failures and the pin-status of the dependencies is correctly extracted.
Which issue(s) this PR fixes
Fixes #3335
Special notes for your reviewer
Does this PR introduce a user-facing change?