[PR #369] [MERGED] fix(ci): skip Docker Scout on fork PRs and add a Trivy scan for every PR #8975

Closed
opened 2026-08-30 22:06:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/369
Author: @arunavo4
Created: 8/24/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @arunavo4

Base: main ← Head: fix/ci-fork-pr-scans


📝 Commits (1)

  • 3ff7f0b fix(ci): skip Docker Scout on fork PRs and add a Trivy scan for every PR

📊 Changes

2 files changed (+59 additions, -24 deletions)

View changed files

📝 .github/workflows/README.md (+10 -17)
📝 .github/workflows/docker-build.yml (+49 -7)

📄 Description

Context: #368. The docker check fails on every fork PR (and Dependabot PR) because GitHub never hands repository secrets to those runs. The Docker Hub login gets empty credentials and Docker Scout then dies with could not authenticate: user githubactions not entitled to use Docker Scout. Same-repo PRs pass because the secrets are there. You can see the pattern in the run history: #367, #365, #362 green, #368, #356, #357, #359 red at the same step.

This isn't a security problem, it's the secret isolation doing its job. The only way to get Scout working on forks would be pull_request_target with the PR head checked out, which would build an untrusted Dockerfile with the Docker Hub token in the environment. Not doing that.

What changed:

  • Docker Hub login and both Scout PR steps now only run when the PR comes from this repo. Same guard the login/push/comment steps already use.
  • New Trivy step scans the locally loaded image on every PR, forks included. No credentials needed. Critical/high with an available fix, written to the job summary since GITHUB_TOKEN is read-only on fork PRs so a comment or SARIF upload wouldn't work anyway. Informational only, same as Scout's exit-code: false.
  • Scout SARIF upload only runs if the file exists, so fork PRs stop logging Path does not exist.
  • Workflows README cleaned up. It still described a docker-scan.yml that doesn't exist.

Testing: this PR is from the main repo so it exercises the same-repo path (Scout + Trivy both run). The fork path can't be triggered from here, but the head.repo.full_name == github.repository guard is the one that already skipped the login/push/comment steps correctly on #368. actionlint is clean apart from four pre-existing shellcheck infos in the tag extraction step.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/369 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 8/24/2026 **Status:** ✅ Merged **Merged:** 8/24/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `fix/ci-fork-pr-scans` --- ### 📝 Commits (1) - [`3ff7f0b`](https://github.com/RayLabsHQ/gitea-mirror/commit/3ff7f0b98e049b5b148cfed7f2ca556f27ce134e) fix(ci): skip Docker Scout on fork PRs and add a Trivy scan for every PR ### 📊 Changes **2 files changed** (+59 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/README.md` (+10 -17) 📝 `.github/workflows/docker-build.yml` (+49 -7) </details> ### 📄 Description Context: #368. The docker check fails on every fork PR (and Dependabot PR) because GitHub never hands repository secrets to those runs. The Docker Hub login gets empty credentials and Docker Scout then dies with `could not authenticate: user githubactions not entitled to use Docker Scout`. Same-repo PRs pass because the secrets are there. You can see the pattern in the run history: #367, #365, #362 green, #368, #356, #357, #359 red at the same step. This isn't a security problem, it's the secret isolation doing its job. The only way to get Scout working on forks would be `pull_request_target` with the PR head checked out, which would build an untrusted Dockerfile with the Docker Hub token in the environment. Not doing that. What changed: - Docker Hub login and both Scout PR steps now only run when the PR comes from this repo. Same guard the login/push/comment steps already use. - New Trivy step scans the locally loaded image on every PR, forks included. No credentials needed. Critical/high with an available fix, written to the job summary since `GITHUB_TOKEN` is read-only on fork PRs so a comment or SARIF upload wouldn't work anyway. Informational only, same as Scout's `exit-code: false`. - Scout SARIF upload only runs if the file exists, so fork PRs stop logging `Path does not exist`. - Workflows README cleaned up. It still described a `docker-scan.yml` that doesn't exist. Testing: this PR is from the main repo so it exercises the same-repo path (Scout + Trivy both run). The fork path can't be triggered from here, but the `head.repo.full_name == github.repository` guard is the one that already skipped the login/push/comment steps correctly on #368. `actionlint` is clean apart from four pre-existing shellcheck infos in the tag extraction step. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-08-30 22:06:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#8975