Repository navigation
refactor: resolve Trivy/Hadolint findings and standardize Dockerfiles & configs - #498
Diogo-Rego wants to merge 18 commits into
Conversation
- Use WORKDIR /srv/misp-modules to avoid cd in RUN (Trivy DS-0013) - Add HEALTHCHECK instruction on port 6666 (Trivy DS-0026) - Add -l flag to useradd (Hadolint DL3046) - Use numeric UID for USER instruction (Hadolint DL3066)
- Use WORKDIR /srv/misp-guard to avoid cd in RUN (Trivy DS-0013) - Add HEALTHCHECK instruction on port 8888 (Trivy DS-0026)
- Standardize Dockerfile indentation and format config.json
- Fix warning callout spacing and empty lines in README.md - Add yaml syntax highlighting and fix list indentations in keycloak guide - Clean up heading hashes and list bullets in stunnel guide - Remove trailing whitespace across stunnel examples
- Use WORKDIR instead of cd during git checkouts (DS-0013 / DL3003) - Add EXPOSE and HEALTHCHECK for FastCGI port 9002 (DS-0026) - Consolidate RUN directives
- Standardize JSON indentation to 2 spaces in s3.*.json - Remove trailing whitespace and ensure newline at end of file across supervisor configs, utilities.sh and index.php
|
Can we run those tools as part of the CI/CD? |
Yes, exactly! I'm currently figuring out how to integrate them and checking a build error in |
Add GitHub Actions workflow to automatically run Hadolint and Trivy misconfiguration scans on all Dockerfiles on push and pull requests.
- Add GitHub Actions workflow for Hadolint and Trivy scans - Set Hadolint failure threshold to warning with .hadolint.yaml rules - Enable Trivy filesystem scanning for misconfigurations, vulnerabilities, and secrets - Add .trivyignore for accepted non-root user exceptions (core and guard)
- Bump hadolint/hadolint-action from v3.1.0 to v3.5.0 - Pin aquasecurity/trivy-action to v0.36.0
|
@ostefano, I've prepared a dedicated GitHub Actions workflow running both Hadolint and Trivy:
Both checks run in ~20 seconds and pass cleanly. I have this ready on a separate branch ( Would you prefer me to include this workflow in this PR, or should I open a dedicated follow-up PR right after this one is merged? |
|
Add the workflows in this PR, flag it as ready for review, so we can test run them here. |
ci: add Hadolint and Trivy workflow with ShellCheck fixes
|
@ostefano I've applied the changes and tested the images with |
ostefano
left a comment
There was a problem hiding this comment.
I see many changes on actual code, so we want to test it thoroughly.
I also think we should a section in the README with instructions how to run the linters locally so we catch issues (and fix them) before committing.
@Diogo-Rego this the only actionable comment from my review. |
…consolidation in core
|
@ostefano Sorry, I hadn't noticed your review comment earlier! I have addressed it:
Feel free to take another look whenever you have time. Thanks! |
|
Thanks, just note that reverting was not mandatory (as per my other
comment).
Feel free to revert the revert :)
…On Thu, 19 Nov 2026 at 10:09, Diogo Rego ***@***.***> wrote:
*Diogo-Rego* left a comment (MISP/misp-docker#498)
<#498 (comment)>
@ostefano <https://github.com/ostefano> Sorry, I hadn't noticed your
review comment earlier!
I have addressed it:
- Added a dedicated section to the README.md (*"Running Linters and
Security Checks Locally"*) detailing how to execute Hadolint and Trivy
locally using Docker, Podman, and native CLIs.
- Reverted the RUN consolidation in core/Dockerfile back to separate
instructions as well.
Feel free to take another look whenever you have time. Thanks!
—
Reply to this email directly, view it on GitHub
<#498?email_source=notifications&email_token=AAHPEQEJXLC5C6QP3VE4VGL5Z3BEBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBQGYYDEMBZGY3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-7006020966>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHPEQDHIWODAFVYWZKC2BD5Z3BEBAVCNFSNUABFKJSXA33TNF2G64TZHM3TENZWHAYTAOJWHNEXG43VMU5TMNBUGEYTEMBSGU4KC5QC>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This PR addresses security misconfigurations and lint issues identified by Trivy and Hadolint across all service Dockerfiles (
nginx,modules,guard, andcore). It introduces an automated CI workflow for linting and security checks, and standardizes configuration formatting, JSON indentation, and trailing whitespaces throughout the codebase.Key Changes
CI / CD Integration
.github/workflows/lint.yml): Added an automated GitHub Actions workflow running on pushes and pull requests tomaster:hadolint/hadolint-action@v3.5.0): Recursively lints all Dockerfiles against best practices withfailure-threshold: warning.aquasecurity/trivy-action@v0.36.0): Scans filesystem (trivy fs) for Dockerfile misconfigurations, vulnerabilities, and accidental secret/token leaks..hadolint.yaml: Configured to ignore non-applicable package pinning rules (DL3008,DL3013,DL3009,DL4006).trivy.yaml: Scoped to Dockerfile misconfiguration and secret scanners withexit-code: 1..trivyignore: Documented exception forDS-0002(root user incoreandguardcontainers, which run as root by design).Dockerfiles Lint & Security
nginx/Dockerfile:RUNwith explicitWORKDIR(DS-0013).101:101) for/var/wwwto fix rootless Podman/Buildah build compatibility.HEALTHCHECK CMDto JSON array format (DL3025) and pinned numeric user IDs (DL3066).[ ! -z ... ]to idiomatic[ -n ... ](SC2236).modules/Dockerfile:cdwithWORKDIRfor repository checkouts (DS-0013).EXPOSE 6666and containerHEALTHCHECK(DS-0026).useradd -l,USER ${MISP_UID}, andpip install --no-cache-dir).[ ! -z ... ]to[ -n ... ](SC2236).guard/Dockerfile&guard/config.json:cdwithWORKDIR(DS-0013).EXPOSE 8888and containerHEALTHCHECK(DS-0026).[ ! -z ... ]to[ -n ... ](SC2236).config.jsonwith 2-space indentation.core/Dockerfile:cdwithWORKDIRfor repository checkout (DS-0013).EXPOSE 9002and FastCGIHEALTHCHECK(DS-0026).RUNdirectives in the final stage.[ ! -z ... ]to[ -n ... ](SC2236)."${mod}"and"${mod_version}"to prevent word splitting (SC2086).Code Style & Documentation
core/files/etc/misp-docker/s3.*.json.utilities.sh, andindex.php.docker-compose.yml.docs/andREADME.md.