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 #24

Merged
merged 7 commits into from
Apr 30, 2024
Merged

Integrate Static Code Analysis Tools #24

merged 7 commits into from
Apr 30, 2024

Conversation

sbreker
Copy link
Member

@sbreker sbreker commented Apr 29, 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.

Enhance build security by integrating static code analysis tools: Hadolint,
ShellCheck, and Checkov.

Scan using ShellCheck, Hadolint and Checkov are restricted to the 1.1.21.2
release folder.
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.
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 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.
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 requested a review from sevein April 29, 2024 23:13
Copy link
Member

@sevein sevein left a comment

Choose a reason for hiding this comment

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

Thank you!

@sevein sevein merged commit 769ae84 into main Apr 30, 2024
3 checks passed
@sevein sevein deleted the dev/add-linters branch April 30, 2024 03:35
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.

2 participants