diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index e04f766..7b80b27 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -36,17 +36,21 @@ jobs: echo "a refresh pull request covered these findings this week" exit 0 fi + version=$(cat VERSION) + [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "unexpected VERSION '$version'"; exit 1; } + next="${version%.*}.$((${version##*.} + 1))" branch="refresh-$(date -u +%Y%m%d%H%M)" git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git switch -c "$branch" date -u +%Y-%m-%dT%H:%M:%SZ >REFRESH + echo "$next" >VERSION base=gcr.io/distroless/cc-debian13:latest digest=$(docker buildx imagetools inspect "$base" --format '{{json .Manifest}}' | jq -r .digest) case "$digest" in sha256:*) sed -i "s#^FROM $base@sha256:[0-9a-f]*#FROM $base@$digest#" Dockerfile ;; esac - git commit -am "build(debian): refresh packages" + git commit -am "build: $next, refresh packages" git push origin "$branch" - gh pr create --base main --head "$branch" --title "build(debian): refresh packages" --label security --body-file body.md + gh pr create --base main --head "$branch" --title "build: $next, refresh packages" --label security --body-file body.md gh workflow run build.yml --ref "$branch" unfixed: diff --git a/README.md b/README.md index 9575ca0..d0e057e 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Web server image for the [Ingrest](https://github.com/ingrest-dev) panel: nginx - A module pull request lists the compared commits and the repository's published security advisories since the pin, and is labelled `security` when a commit names a CVE, an advisory, a memory safety fix or a bypass. - Modules tracked by tags move to their default branch when it has fix commits (not docs, ci, tests) past the pin and the newest tag whose subjects match those words: such fixes can wait months for a release. - `scan` also keeps one issue, "Unfixed vulnerabilities in linked libraries": HIGH or CRITICAL findings without a Debian fix in packages that nginx, its modules or libmodsecurity load. Ids checked as not affecting the image go to `tools/watch/unfixed.ignore` with the reason. -- `scan` runs Trivy on the newest published image every 6 hours: fixable HIGH or CRITICAL Debian packages open a `security` pull request that changes `REFRESH`, which makes the runtime stage reinstall and upgrade its packages. +- `scan` runs Trivy on the newest published image every 6 hours: fixable HIGH or CRITICAL Debian packages open a `security` pull request that changes `REFRESH`, which makes the runtime stage reinstall and upgrade its packages, and bumps the build in `VERSION`. - `patches/` is for emergencies only (see `patches/README.md`). ## Releases diff --git a/tools/watch/scan.sh b/tools/watch/scan.sh index 7e21cc6..2bed67e 100755 --- a/tools/watch/scan.sh +++ b/tools/watch/scan.sh @@ -23,5 +23,5 @@ The published image \`$image\` has fixable HIGH or CRITICAL vulnerabilities in D | --- | --- | --- | --- | --- | $rows -This pull request changes \`REFRESH\`, so the runtime stage downloads current packages instead of its cached layer, and moves the distroless base to its newest digest. +This pull request changes \`REFRESH\`, so the runtime stage downloads current packages instead of its cached layer, moves the distroless base to its newest digest and bumps the build number in \`VERSION\`. EOF