Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/_build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,56 @@ jobs:
exit-code: '1'
trivyignores: '.trivyignore'

# KEV GATE: a CVE in CISA's Known Exploited Vulnerabilities catalog blocks
# promotion whenever a fix exists, at ANY severity. The HIGH/CRITICAL gate
# above would let a fixable, actively exploited MEDIUM or LOW through.
# Unfixed KEV entries do not block here (a rebuild cannot remove them and
# blocking would also hold back every other fix); the hourly watch in
# security-watch.yml fails on those until they carry a reviewed exception.
- name: Fetch CISA KEV catalog
if: inputs.enable-trivy
run: |
for url in https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json \
https://raw.githubusercontent.com/cisagov/kev-data/develop/known_exploited_vulnerabilities.json; do
curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "$url" -o /tmp/kev.json && break
done

- name: Scan for fixable vulnerabilities, all severities (KEV gate input)
if: inputs.enable-trivy
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
env:
TRIVY_PLATFORM: linux/amd64
TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db:2,mirror.gcr.io/aquasec/trivy-db:2
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db:1,mirror.gcr.io/aquasec/trivy-java-db:1
with:
version: v0.76.2
image-ref: ${{ steps.verify_ref.outputs.ref }}
format: 'json'
output: 'trivy-kev-amd64.json'
ignore-unfixed: true

- name: Fail on fixable known-exploited vulnerabilities (amd64, pre-promotion)
if: inputs.enable-trivy
run: python3 scripts/security-watch.py kev-gate --report trivy-kev-amd64.json --kev /tmp/kev.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kev-gate runs scripts/security-watch.py, but the job's sparse checkout (line 854) does not fetch that file. This blocks the merge.

Add scripts/security-watch.py to the sparse-checkout list in the 'Checkout versions.json, CVE baseline and smoke-test scenario' step.


- name: Scan for fixable vulnerabilities, all severities (arm64 KEV gate input)
if: inputs.enable-trivy && needs.build-arm64.outputs.digest != ''
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
env:
TRIVY_PLATFORM: linux/arm64
TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db:2,mirror.gcr.io/aquasec/trivy-db:2
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db:1,mirror.gcr.io/aquasec/trivy-java-db:1
with:
version: v0.76.2
image-ref: ghcr.io/${{ github.repository }}/${{ inputs.image-name }}@${{ needs.build-arm64.outputs.digest }}
format: 'json'
output: 'trivy-kev-arm64.json'
ignore-unfixed: true

- name: Fail on fixable known-exploited vulnerabilities (arm64, pre-promotion)
if: inputs.enable-trivy && needs.build-arm64.outputs.digest != ''
run: python3 scripts/security-watch.py kev-gate --report trivy-kev-arm64.json --kev /tmp/kev.json

- name: Smoke-test image (pre-promotion)
if: inputs.test-script != ''
env:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/maintain-previous-majors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Rebuild previous majors (security maintenance)

# Scheduled workflows only run on the default branch, so the weekly crons in a
# release/vN branch never fire. This job starts the maintenance branch's own
# build chain instead: php-base and nginx there, and php-base dispatches its
# downstream images on the same branch when it finishes.
#
# Which majors are maintained, from which branch and until when, lives in
# versions.json under release.maintenance.
on:
schedule:
- cron: '17 3 * * 1'
workflow_dispatch:

concurrency:
group: maintain-previous-majors
cancel-in-progress: false

permissions:
contents: read
actions: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new workflow grants actions: write workflow-wide so it can dispatch builds on release branches. Not blocking, but the scope should be narrowed.

Move permissions (contents: read, actions: write) to the dispatch job, set the workflow level to permissions: {}, and add a comment saying the write scope exists only for gh workflow run.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

actions: write is granted to the whole workflow, not to the one job that dispatches. Not blocking.

Set top-level permissions: {} and move contents: read and actions: write under jobs.dispatch.permissions.


jobs:
dispatch:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Start each maintained branch's build chain
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
TODAY=$(date -u +%F)
jq -r --arg today "$TODAY" '
.release as $r
| $r.maintenance // {} | to_entries[]
| select((.key as $k | $r.supported_majors | index($k)) and .value.until >= $today)
| .value.branch' versions.json | while read -r BRANCH; do
for WF in build-php-base.yml build-nginx.yml; do
if gh run list --workflow "$WF" --branch "$BRANCH" --limit 20 --json status \
--jq 'any(.[]; .status != "completed")' | grep -q true; then
echo "$WF@$BRANCH already running; skipped"
continue
fi
gh workflow run "$WF" --ref "$BRANCH"
echo "Dispatched $WF@$BRANCH" | tee -a "$GITHUB_STEP_SUMMARY"
done
done
13 changes: 11 additions & 2 deletions .github/workflows/security-watch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Published image CVE watch
name: Published image CVE/KEV watch
on:
schedule:
- cron: '43 * * * *'
Expand Down Expand Up @@ -45,10 +45,19 @@ jobs:
path: .build/trivy-db
key: security-db-${{ steps.db.outputs.bucket }}
restore-keys: security-db-
- name: Fetch CISA Known Exploited Vulnerabilities catalog
run: |
# CISA first, its GitHub mirror second. load_kev() rejects a truncated
# catalog, so a failed download fails the watch instead of passing it.
for url in https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json \
https://raw.githubusercontent.com/cisagov/kev-data/develop/known_exploited_vulnerabilities.json; do
curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors "$url" -o .build/kev.json && break
done
jq -r '"KEV catalog \(.catalogVersion): \(.count) entries"' .build/kev.json
- name: Scan current CVE database and request mitigation
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/security-watch.py scan --plan .build/security-plan.json --cache .build/security-sboms --output .build/security-results --dispatch
run: python3 scripts/security-watch.py scan --plan .build/security-plan.json --cache .build/security-sboms --output .build/security-results --kev .build/kev.json --dispatch
- uses: actions/cache/save@v6
if: always() && steps.images.outcome == 'success' && steps.inventory-cache.outputs.cache-hit != 'true'
with:
Expand Down
18 changes: 13 additions & 5 deletions docs/reference/tagging-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ rebuilds for **6 months** (from a `release/vN` maintenance branch), then goes
EOL. Which majors are in support is recorded in `versions.json` under
`release.supported_majors`.

**Current status:** v2 is an unpublished local candidate using Debian 13
(Trixie). V1 production remains on Debian 12 (Bookworm). The six-month v1
maintenance window starts when v2 ships, not while this candidate is tested.
Before publication, activate and verify builds from the existing `release/v1`
maintenance branch. A supported-major entry alone does not schedule builds.
**How v1 is kept patched:** scheduled workflows only run on the default
branch, so `maintain-previous-majors.yml` on `main` starts the `release/v1`
build chain every Monday, and the branch chains its own downstream images.
v1 (Debian 12 Bookworm) is maintained until 2027-05-07, as recorded in
`versions.json` under `release.maintenance`.

**Known exploited vulnerabilities:** the hourly watch scans the current and
every maintained channel against CISA's
[KEV catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog) at
every severity, fixed or not. A fixable KEV entry blocks tag promotion and
triggers a rebuild. An unfixed one fails the watch until Debian ships a fix,
unless `security/kev-exceptions.json` records why the image is not exposed,
with an expiry date.

```yaml
# Recommended production pin: behavior locked, security patches current
Expand Down
Loading
Loading