-
Notifications
You must be signed in to change notification settings - Fork 161
Add Security & License Scanning Workflow to CI #1067
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds automated security and license scanning to the CI pipeline using Trivy, and includes Docker security improvements by switching containers to run as non-root users. The changes address issue #1038 regarding potential license issues discovered when running SBOM analysis.
Changes:
- Added a
check-securityjob to the PR validation workflow that scans for vulnerabilities, secrets, misconfigurations, and license issues using Trivy - Modified two Dockerfiles to run containers as the
nobodyuser instead of root for improved security posture
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/workflows/pr.yaml |
Adds new check-security job with Trivy scanner to detect HIGH and CRITICAL security and license issues during PR validation |
build/dockerfiles/init/Dockerfile |
Switches container to run as nobody user for security hardening |
build/ci/Dockerfile |
Switches container to run as nobody user with proper permission handling for the test directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -8,6 +8,8 @@ FROM $KIT_BASE_IMAGE | |||
| COPY entrypoint.sh /usr/local/bin/entrypoint.sh | |||
| COPY --from=cosign-install /ko-app/cosign /usr/local/bin/cosign | |||
|
|
|||
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to USER nobody without adjusting file permissions may cause runtime failures. The base image (KIT_BASE_IMAGE) creates /home/user/ owned by the kit user (UID 1001), but the entrypoint.sh script defaults to unpacking to /home/user/modelkit/. The nobody user won't have write permissions to this directory.
Consider adding a RUN command before USER nobody to ensure the nobody user can write to necessary directories, similar to the approach used in build/ci/Dockerfile:11 where permissions are set with chown -R nobody:nogroup /app before switching users. Alternatively, you could create and set permissions on the default unpack path:
RUN mkdir -p /home/user/modelkit && chown -R nobody:nogroup /home/user
| RUN mkdir -p /home/user/modelkit && chown -R nobody:nogroup /home/user |
| check-security: | ||
| name: Security and license scan |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description states that a "check-licenses" job was added, but the actual job name in the workflow is "check-security". While this is a minor discrepancy and the broader name "check-security" is arguably more accurate given that the job scans for vulnerabilities, secrets, misconfigurations, and licenses (not just licenses), the PR description should be updated to match the actual implementation.
| COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
| COPY --from=cosign-install /ko-app/cosign /usr/local/bin/cosign | ||
|
|
||
| USER nobody |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description does not mention the Docker USER changes in this file. This is a significant security-related change that switches the container to run as the nobody user instead of root (or the kit user from the base image). While this aligns with security best practices, such changes should be documented in the PR description, especially since this change has potential implications for container permissions and runtime behavior.
| chown -R nobody:nogroup /app | ||
|
|
||
| ENTRYPOINT ["bats", "tests"] No newline at end of file | ||
| USER nobody |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description does not mention the Docker USER changes in this file. This is a significant security-related change that switches the container to run as the nobody user. While this aligns with security best practices, such changes should be documented in the PR description.
Description
CI Workflow
check-licensesjob to.github/workflows/pr.yamlLinked issues
AI-Assisted Code