fix(ci): add non-root user to test Containerfile - #291
Conversation
Trivy source scan flags DS-0002 (Image user should not be root) on the test Containerfile used by ci_test_publish_ghcr. Add USER nobody to satisfy the misconfig check. Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
|
CI note: The @trevor-vaughan -- to avoid these recurring failures on fork PRs while preserving the intent of these test workflows, would it make sense to gate them with a fork detection condition? For example: if: >-
needs.check-changes.outputs.ghcr_files_changed == 'true' &&
github.event.pull_request.head.repo.full_name == github.repositoryThis would cleanly skip the publish tests on fork PRs (where they can never succeed due to token restrictions) while keeping them running for internal PRs. |
|
@marcusburghardt Good call on the fork check. Do you want to add that to this PR? |
Sure. It should be a couple of lines, but would like to get your thoughts before. :) Let me do that in a minute. |
Fork PRs receive a GITHUB_TOKEN with read-only packages permission, making it impossible to push images to GHCR. Gate the publish test jobs so they only run on internal PRs where the token has the required write access. Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
|
Change makes sense. Sorry for not thinking about that earlier! |
No worries. I also didn't "see" this during review. : ) |
dependabot[bot] is not an org member, so the org membership check in reusable_publish_ghcr.yml always fails for dependabot PRs that touch GHCR-related files. The fork detection guard from #291 does not help because dependabot branches live in the same repository. Add an actor exclusion so the GHCR integration test jobs skip cleanly for dependabot PRs instead of producing false failures. Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
Summary
Trivy source scan flags
DS-0002(Image user should not be root) on the testContainerfile used by
ci_test_publish_ghcr. This was introduced in #285.Adds
USER nobodyto satisfy the misconfig check.Related Issues
Review Hints
USER nobody) to a test-only Containerfile. The image only runscat /test-markerwhich does not require root.