Not Using JSON In CMD And ENTRYPOINT Arguments

  • Query id: b86987e1-6397-4619-81d5-8807f2387c79
  • Query name: Not Using JSON In CMD And ENTRYPOINT Arguments
  • Platform: Dockerfile
  • Severity: Medium
  • Category: Build Process
  • URL: Github

Description

Ensure that we are using JSON in the CMD and ENTRYPOINT Arguments
Documentation

Code samples

Code samples with security vulnerabilities

Postitive test num. 1 - dockerfile file
FROM alpine:3.5
RUN apk add --update py2-pip
RUN sudo yum install bundler
RUN yum install
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
COPY app.py /usr/src/app/
COPY templates/index.html /usr/src/app/templates/
EXPOSE 5000
CMD [python, /usr/src/app/app.py] 
ENTRYPOINT [top, -b]

Code samples without security vulnerabilities

Negative test num. 1 - dockerfile file
FROM alpine:3.5
RUN apk add --update py2-pip
RUN sudo yum install bundler
RUN yum install
COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
COPY app.py /usr/src/app/
COPY templates/index.html /usr/src/app/templates/
EXPOSE 5000
CMD ["python", "/usr/src/app/app.py"] 
ENTRYPOINT ["top", "-b"]