@@ -19,6 +19,27 @@ HEALTHCHECK --interval=30s CMD node healthcheck.js
1919
2020HEALTHCHECK CMD curl --fail http://localhost:8080/healthcheck || exit 1
2121
22+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
23+ CMD echo $message
24+
25+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
26+ CMD echo ${message-default}
27+
28+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
29+ CMD echo ${message:=default}
30+
31+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
32+ CMD echo ${message:+var}
33+
34+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
35+ CMD echo ${message:7}
36+
37+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
38+ CMD echo ${message:7:0}
39+
40+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
41+ CMD echo "$message"
42+
2243# FNs: exec form with explicit shell invocation are not supported
2344CMD ["sh", "-c", "echo $message"]
2445CMD ["sh", "-c", "echo ${message-default}"]
@@ -34,6 +55,21 @@ CMD ["sh", "-c", "echo \"Welcome\" ; echo \"Goodbye\""]
3455CMD ["sh", "-c", "echo \"Welcome\" | echo \"Goodbye\""]
3556CMD ["sh", "-c", "echo \"Welcome\" && echo \"Goodbye\" || echo \"Goodbye\" ; echo \"Goodbye\" | echo \"Goodbye\""]
3657
58+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
59+ CMD echo "Welcome" && echo "Goodbye"
60+
61+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
62+ CMD echo "Welcome" || echo "Goodbye"
63+
64+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
65+ CMD echo "Welcome" ; echo "Goodbye"
66+
67+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
68+ CMD echo "Welcome" | echo "Goodbye"
69+
70+ # Noncompliant@+1 {{Consider wrapping this instruction in a script file and call it with exec form.}}
71+ CMD echo "Welcome" && echo "Goodbye" || echo "Goodbye" ; echo "Goodbye" | echo "Goodbye"
72+
3773# Noncompliant@+1
3874CMD this is a very \
3975 long multi-line \
@@ -43,13 +79,14 @@ CMD this is a very \
4379CMD this is a very long instruction that is settled on a single line aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4480# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4581
46-
4782RUN echo "Welcome!"
4883CMD ["echo", "Welcome!"]
4984ENTRYPOINT ["echo", "Welcome!"]
5085
5186SHELL ["sh", "-c"]
5287# Compliant: if we met a SHELL instruction before, then we consider it's a conscious decision and don't raise an issue
88+ CMD echo "Welcome!"
89+ CMD echo "Welcome" && echo "Goodbye" || echo "Goodbye" ; echo "Goodbye" | echo "Goodbye"
5390CMD ["echo", "\"Welcome!\""]
5491CMD ["sh", "-c", "echo \"Welcome\" && echo \"Goodbye\" || echo \"Goodbye\" ; echo \"Goodbye\" | echo \"Goodbye\""]
5592
@@ -82,3 +119,10 @@ FROM scratch
82119SHELL ["sh", "-c"]
83120# Compliant: extra use case with a SHELL instruction in an image without alias
84121CMD ["echo", "\"Welcome!\""]
122+
123+ FROM scratch AS builder2
124+ # Invalid exec form: no quotes around python. Parsed as shell form.
125+ # Noncompliant@+1
126+ CMD [python, /usr/src/app/app.py]
127+ # Noncompliant@+1
128+ ENTRYPOINT [top, -b]
0 commit comments