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

Integrate Static Code Analysis Tools #23

Closed
wants to merge 12 commits into from
Closed

Integrate Static Code Analysis Tools #23

wants to merge 12 commits into from

Conversation

sbreker
Copy link
Member

@sbreker sbreker commented Apr 26, 2024

This pull request enhances build security by integrating three static code analysis tools as Github actions: Hadolint, ShellCheck, and Checkov.

Scan using ShellCheck, Hadolint and Checkov are restricted to the 1.1.21.2 release folder.

This PR also addresses the items that these tools have identified.

sbreker added 5 commits April 19, 2024 16:44
Override rule DL3003 "Use WORKDIR to switch to a directory" to 'info'
severity.
Docker only evaluates the exit code of the last operation after the pipe
in a RUN statement to determine success. Specifying 'pipefail' will cause
the build to fail due to an error at any stage of a RUN command with
pipes.

Addresses Hadolint DL4006 warning: Set the SHELL option -o pipefail
before RUN with a pipe in it.

Setting the -e option instructs bash to immediately exit if any command
in a RUN statement has a non-zero exit status.

Setting the -u option triggers an error if a variable is referenced that
has not been previously defined.

Setting runDeps using a list passed to 'apk info --installed' returns a
non zero exit status if one of the packages listed is not installed.
Added '|| true' to force an exit status of 0.
@sbreker sbreker force-pushed the dev/add-linters branch 3 times, most recently from c5d89af to c051533 Compare April 28, 2024 16:01
sbreker added 4 commits April 29, 2024 13:48
Check for open gearmand port. Healthcheck will fail if gearmand is not
listening.

Addresses Checkov issue: CKV_DOCKER_2: "Ensure that HEALTHCHECK
instructions have been added to container images"
Skip Hadolint rule DL3018 (Pin versions in apk add) and SC2086 (Double
quote to prevent globbing and word splitting) because package list
'runDeps' is programmatically generated.
Adresses Hadolint issue - DL3047 info: Avoid use of wget without progress
bar.
sbreker added 3 commits April 29, 2024 14:04
Skip Hadolint rule DL3003 (Use WORKDIR to switch to a directory) as
breaking up the main 'RUN apk add' statement would create more layers in
the build.
Ignoring Hadolint rule DL3019 (Use the --no-cache switch) as this
appears to be a false positive. Dockerfile is making use of the
'--no-cache' switch.
Skip Hadolint rule DL3018 (DL3018 warning: Pin versions in apk add)
because Alpine does not keep older package versions which will cause
builds to break when packages are updated.

Skip Hadolint rule DL3003 (Use WORKDIR to switch to a directory) as
breaking up the main 'RUN apk add' statement would create more layers in
the build.
@sbreker sbreker closed this Apr 29, 2024
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.

1 participant