Skip to content

Conversation

@marcoesters
Copy link
Contributor

Harden the GitHub Actions that build the Docker images by

  • restricting permissions of each workflow
  • pinning the QEMU image to the hash
  • disabling persisting permissions
  • disabling caching the buildx binary to prevent cache poisoning
  • pinning the buildx version.

@marcoesters marcoesters marked this pull request as ready for review May 28, 2025 19:59
@marcoesters marcoesters requested a review from dbast May 28, 2025 20:00
with:
# https://github.com/docker/setup-qemu-action/issues/188#issuecomment-2604322104
image: tonistiigi/binfmt:qemu-v8.1.5
image: tonistiigi/binfmt:qemu-v8.1.5@sha256:2d2918e86e5327d0661f7083d67a95280b0f7be8f77ed79a8418f81d7d90ce6f
Copy link
Member

@dbast dbast May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add a renovate annotation here? also the issue in the comment seem to be resolved via qemu-v9.2.0 -> can be updated when renovate proposes the container update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, the newest QEMU image seems to work. In that case, we can definitely add a renovate rule to this and the buildkit image.

Comment on lines +24 to +25
with:
persist-credentials: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this can be done, it achieves not much: The default GITHUB_TOKEN only has read access to public repos, is anyways only valid until end of the workflow run, all the other action steps anyways have access to that token no matter if the checkout step persists it or not.... not sure if its worth to have those two extra line in every workflow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true for the default token, but I don't see any harm in not persisting it. If you think we should leave the default as is, I can revert this.

@marcoesters marcoesters requested a review from dbast May 30, 2025 21:45
renovate.json Outdated
Comment on lines 18 to 43
},
{
"customType": "regex",
"fileMatch": [
"^\\.github/workflows/[^/]+\\.ya?ml$"
],
"matchStrings": [
"#\\s*renovate:\\s*datasource=(?<datasource>.*?)\\s+depName=(?<depName>.*?)\\s+version:\\s*(?<currentValue>.*?)\\s"
]
},
{
"customType": "regex",
"fileMatch": [
"^\\.github/workflows/[^/]+\\.ya?ml$"
],
"matchStrings": [
"image[:|=]\\s*(?<depName>.*?):(?<currentValue>.*?)@(?<currentDigest>.*?)"
],
"datasourceTemplate": "docker"
}
],
"packageRules": [
{
"matchDatasources": ["docker"],
"matchPackageNames": ["tonistiigi/binfmt"],
"versioning": "regex:^qemu-v(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)$"
Copy link
Member

@dbast dbast Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find reviewing and maintaining regex code always a bit risky... Just thinking a bit more here:

so we can have this on job/workflow level without further configuring / creating new regexes:

env:
          # renovate: datasource=github-releases depName=docker/buildx
          BUILDX_VERSION: 'v0.24.0'

and use that via:

with:
          version: ${{ env.BUILDX_VERSION }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this for the Docker images, too, so that we do not need any additional regex managers.

@marcoesters marcoesters requested a review from dbast June 9, 2025 16:04
Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why we put those versions in env vars, can't we just keep this inline?

@marcoesters
Copy link
Contributor Author

I am not sure why we put those versions in env vars, can't we just keep this inline?

See this thread: #656 (comment)

Using environment variables this way makes for much simpler renovate integration since it supports the *_VERSION: scheme in workflow files by default. The alternative is to use a regex manager: 6723ea4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants