Conversation
| uses: zondax/_workflows/.github/workflows/_publish-docker-bake.yaml@main | ||
| with: | ||
| registry: dockerhub | ||
| enable_remote_builder: true | ||
| enable_signing: true | ||
| enable_provenance: true | ||
| secrets: | ||
| DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | ||
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| REMOTE_BUILD_KIT: tcp://buildkit.int-dev.zondax.io:8372 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the problem, explicitly declare a permissions block that grants only the minimal required scopes to GITHUB_TOKEN. For a publish-to-registry workflow that doesn’t obviously need to write to the repository (no checkouts, tagging, or releases in the shown snippet), a conservative starting point is repository contents read-only plus packages write (so the token can push images if needed). This should be declared at the workflow root so it applies to the reused job unless that job overrides it.
Concretely, in .github/workflows/publish-docker-bake.yml, insert a root-level permissions section between the on: block and the jobs: block (around line 17). Use:
permissions:
contents: read
packages: writeThis keeps repository contents read-only while allowing package publishing (e.g., to GitHub Container Registry). If the reusable workflow later proves to need more/less, this block can be adjusted, but this is a safe, least-privilege default that resolves the CodeQL finding without changing any functional behavior for Docker Hub publishing (which uses explicit secrets, not GITHUB_TOKEN).
| @@ -15,6 +15,10 @@ | ||
| - 'v[0-9]+.[0-9]+' | ||
| - 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: zondax/_workflows/.github/workflows/_publish-docker-bake.yaml@main |
Migrate from Earthly to Docker Bake build system. Adds Dockerfile, docker-bake.hcl, helper script, CI workflow, and .dockerignore.