Add Trivy container security scanning, fix ShellCheck targeting, update binary container and harden utility scripts#572
Add Trivy container security scanning, fix ShellCheck targeting, update binary container and harden utility scripts#572Jmevorach wants to merge 16 commits intoopenemr:masterfrom
Conversation
- Add a CI workflow that builds the 8.0.1, binary, and flex Docker images and runs Trivy vulnerability scanning against them, failing on any unignored CRITICAL or HIGH severity findings - Fix the ShellCheck workflow to exclude frozen production images (7.0.3, 7.0.4, 8.0.0) whose scripts cannot be modified without risking released builds - Add a .trivyignore.yaml to document and exclude upstream OpenEMR application vulnerabilities (schemaspy.jar Java dependencies and npm dependencies) that cannot be addressed in the Dockerfiles
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
The binary image is a proof-of-concept and does not use an up to date version of OpenEMR and including it would require we expand the trivyignore file.
|
This seems generally positive. Could you glance at the Trivy run https://github.com/openemr/openemr-devops/actions/runs/22650483911/job/65648544747?pr=572 and clear the warning, please? It wants a deprecated action updated, I think. |
|
@jesdynf Done -- bumped github/codeql-action/upload-sarif from v3 to v4. |
|
Much obliged! I'm checking on something elsewhere before I pull this in. |
kojiromike
left a comment
There was a problem hiding this comment.
Thanks for adding Trivy scanning and cleaning up the ShellCheck workflow. A few structural and correctness questions below.
The biggest concern is scope: the ShellCheck targeting fixes, shell script quoting fixes, and Trivy introduction are independent changes. Would it make sense to split this into at least two PRs — one for the ShellCheck/utility-script fixes and one for Trivy? That way the quoting fixes can land immediately without coupling to the Trivy discussion.
|
@jesdynf @kojiromike That's a fair point about scope. I'm happy to split this if you feel strongly about it, but my rationale for keeping them together was that ShellCheck + Trivy represent the two remaining pieces needed to complete a baseline CI/CD security posture for the devops repo — ShellCheck for static analysis of our shell scripts, Trivy for container-level vulnerability scanning. They felt like a natural unit of work. That said, if splitting would help get the ShellCheck fixes merged faster, I can pull those into a separate PR. Let me know your preference. |
|
Thanks for the thorough review, @kojiromike. I've pushed updates addressing your feedback:
On the broader points:
|
|
Pushed the .shellcheck-skip marker file approach and removed all the hardcoded exclusions from the workflow YAML. ShellCheck is passing cleanly now -- the only source of truth for which directories to skip is the presence of a .shellcheck-skip file in that directory, so future changes are just a matter of adding or removing a single empty file. Also, when I was re-reading my earlier comment I realized I was being redundant explaining Trivy -- you obviously know what it does; my bad. Appreciate the review feedback throughout, it's made this PR a lot better. |
|
Re-added the binary image to the Trivy scan. Since we're now using --skip-dirs to scope scanning to OS packages and container-layer concerns only, the older OpenEMR version bundled in the binary image won't inflate the results. |
|
Updated the binary container to use the latest builds from openemr-static-binary-forge (OpenEMR 8.0.0, built 03/10/2026) and re-added it to the Trivy scan. Now that we're using --skip-dirs to scope Trivy to OS packages and container-layer concerns only, the binary image can be scanned cleanly without needing a long ignore list. |
Short description of what this resolves:
Changes proposed in this pull request: