From e97eb0a8cabbfa5a47a59559b636e53ae680bf17 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 15:24:18 +0200 Subject: [PATCH 1/9] ci(security): add container validation checks --- .github/dependabot.yml | 15 ++ .github/scripts/validate_compose.py | 150 ++++++++++++++++++ .github/workflows/build_develop.yml | 1 + .github/workflows/build_stable.yml | 1 + .github/workflows/core-build-develop.yml | 1 + .github/workflows/core-build-stable.yml | 1 + .github/workflows/core-build-test-images.yml | 75 +++++++++ .hadolint.yaml | 8 + .pre-commit-config.yaml | 24 +++ .../06-github-actions-image-workflows.md | 16 +- docs/08-reference/08-container-validation.md | 95 +++++++++++ overrides/compose.nginxproxy-ssl.yaml | 2 +- overrides/compose.nginxproxy.yaml | 2 +- tests/compose-configs.json | 142 +++++++++++++++++ 14 files changed, 525 insertions(+), 8 deletions(-) create mode 100644 .github/scripts/validate_compose.py create mode 100644 .hadolint.yaml create mode 100644 docs/08-reference/08-container-validation.md create mode 100644 tests/compose-configs.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1085653..e367347 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,6 +17,21 @@ updates: schedule: interval: weekly + - package-ecosystem: docker-compose + directory: /overrides + schedule: + interval: weekly + allow: + - dependency-name: nginxproxy/acme-companion + - dependency-name: nginxproxy/nginx-proxy + - dependency-name: traefik + groups: + proxy-images: + patterns: + - nginxproxy/acme-companion + - nginxproxy/nginx-proxy + - traefik + - package-ecosystem: pip directory: / schedule: diff --git a/.github/scripts/validate_compose.py b/.github/scripts/validate_compose.py new file mode 100644 index 0000000..feb5c34 --- /dev/null +++ b/.github/scripts/validate_compose.py @@ -0,0 +1,150 @@ +"""Validate every supported Docker Compose override combination.""" + +import json +import os +import subprocess +import sys +from pathlib import Path +from typing import Dict, List + +ROOT = Path(__file__).resolve().parents[2] +MATRIX_PATH = ROOT / "tests" / "compose-configs.json" +OVERRIDES_PATH = ROOT / "overrides" + + +def fail(message: str) -> None: + print(f"Compose validation configuration error: {message}", file=sys.stderr) + raise SystemExit(1) + + +def load_matrix() -> Dict[str, object]: + try: + matrix = json.loads(MATRIX_PATH.read_text(encoding="utf-8")) + except (OSError, json.JSONDecodeError) as exc: + fail(f"cannot read {MATRIX_PATH.relative_to(ROOT)}: {exc}") + + if not isinstance(matrix, dict): + fail("the matrix root must be a JSON object") + + environment = matrix.get("environment") + configurations = matrix.get("configurations") + if not isinstance(environment, dict): + fail("'environment' must be a JSON object") + if not isinstance(configurations, list) or not configurations: + fail("'configurations' must be a non-empty JSON array") + + return matrix + + +def validate_matrix(configurations: List[object]) -> None: + names = set() + covered_overrides = set() + + for index, configuration in enumerate(configurations, start=1): + if not isinstance(configuration, dict): + fail(f"configuration #{index} must be a JSON object") + + name = configuration.get("name") + files = configuration.get("files") + if not isinstance(name, str) or not name: + fail(f"configuration #{index} needs a non-empty 'name'") + if name in names: + fail(f"configuration name '{name}' is duplicated") + names.add(name) + + if not isinstance(files, list) or not files: + fail(f"configuration '{name}' needs a non-empty 'files' array") + if len(files) != len(set(files)): + fail(f"configuration '{name}' references a file more than once") + + for filename in files: + if not isinstance(filename, str): + fail(f"configuration '{name}' contains a non-string file name") + + path = ROOT / filename + if not path.is_file(): + fail(f"configuration '{name}' references missing file '{filename}'") + if path.parent == OVERRIDES_PATH: + covered_overrides.add(path.relative_to(ROOT).as_posix()) + + existing_overrides = { + path.relative_to(ROOT).as_posix() + for path in OVERRIDES_PATH.glob("compose.*.yaml") + } + uncovered_overrides = sorted(existing_overrides - covered_overrides) + if uncovered_overrides: + formatted = "\n - ".join(uncovered_overrides) + fail( + "every override must be covered by at least one configuration in " + f"{MATRIX_PATH.relative_to(ROOT)}. Add:\n - {formatted}" + ) + + +def validate_compose( + configurations: List[object], environment: Dict[str, object] +) -> int: + compose_environment = os.environ.copy() + for key, value in environment.items(): + if not isinstance(key, str) or not isinstance(value, str): + fail("all 'environment' keys and values must be strings") + compose_environment[key] = value + + failures = 0 + total = len(configurations) + for index, configuration in enumerate(configurations, start=1): + name = configuration["name"] + files = configuration["files"] + command = [ + "docker", + "compose", + "--project-directory", + str(ROOT), + "--env-file", + str(ROOT / "example.env"), + ] + for filename in files: + command.extend(("-f", str(ROOT / filename))) + command.extend(("config", "--quiet")) + + print(f"[{index}/{total}] Validating {name}") + try: + result = subprocess.run( + command, + cwd=ROOT, + env=compose_environment, + text=True, + capture_output=True, + check=False, + ) + except FileNotFoundError: + fail("Docker Compose is required, but the 'docker' command was not found") + + if result.returncode: + failures += 1 + print(f"FAILED: {name}", file=sys.stderr) + if result.stdout: + print(result.stdout.rstrip(), file=sys.stderr) + if result.stderr: + print(result.stderr.rstrip(), file=sys.stderr) + + if failures: + print( + f"{failures} of {total} Compose configurations failed validation.", + file=sys.stderr, + ) + return 1 + + print(f"Validated {total} Compose configurations.") + return 0 + + +def main() -> int: + matrix = load_matrix() + configurations = matrix["configurations"] + environment = matrix["environment"] + validate_matrix(configurations) + return validate_compose(configurations, environment) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/workflows/build_develop.yml b/.github/workflows/build_develop.yml index dfb0ee6..f52ebc9 100644 --- a/.github/workflows/build_develop.yml +++ b/.github/workflows/build_develop.yml @@ -9,4 +9,5 @@ jobs: permissions: contents: read packages: write + security-events: write secrets: inherit diff --git a/.github/workflows/build_stable.yml b/.github/workflows/build_stable.yml index c00f89f..451a983 100644 --- a/.github/workflows/build_stable.yml +++ b/.github/workflows/build_stable.yml @@ -9,4 +9,5 @@ jobs: permissions: contents: write packages: write + security-events: write secrets: inherit diff --git a/.github/workflows/core-build-develop.yml b/.github/workflows/core-build-develop.yml index 8e6ceef..44d214b 100644 --- a/.github/workflows/core-build-develop.yml +++ b/.github/workflows/core-build-develop.yml @@ -3,6 +3,7 @@ name: Core / Build Develop permissions: contents: read packages: write + security-events: write on: workflow_call: diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 9f364a0..39422ed 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -3,6 +3,7 @@ name: Core / Build Stable permissions: contents: read packages: write + security-events: write on: workflow_call: diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 1f3dabe..934a1ba 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -29,6 +29,7 @@ on: permissions: contents: read + security-events: write jobs: resolve: @@ -94,6 +95,80 @@ jobs: env: REGISTRY_USER: localhost:5000/frappe + - name: Create Trivy report directory + run: mkdir -p trivy-results + + - name: Scan base image + id: trivy_base + continue-on-error: true + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: localhost:5000/frappe/base:${{ env.FRAPPE_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/base.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + + - name: Scan build image + if: ${{ env.ERPNEXT_VERSION != '' }} + id: trivy_build + continue-on-error: true + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: localhost:5000/frappe/build:${{ env.ERPNEXT_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/build.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + skip-setup-trivy: true + + - name: Scan ERPNext image + if: ${{ env.ERPNEXT_VERSION != '' }} + id: trivy_erpnext + continue-on-error: true + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: localhost:5000/frappe/erpnext:${{ env.ERPNEXT_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/erpnext.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + skip-setup-trivy: true + + - name: Upload Trivy report artifact + if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} + continue-on-error: true + uses: actions/upload-artifact@v4 + with: + name: trivy-${{ inputs.version }}-${{ matrix.arch }} + path: trivy-results/*.sarif + retention-days: 30 + + - name: Upload Trivy results to code scanning + if: >- + ${{ + always() && + hashFiles('trivy-results/*.sarif') != '' && + ( + github.event_name != 'pull_request' || + github.event.pull_request.head.repo.full_name == github.repository + ) + }} + continue-on-error: true + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: trivy-results + category: trivy-${{ inputs.version }}-${{ matrix.arch }} + - name: Setup Python uses: actions/setup-python@v7 with: diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..9f64091 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,8 @@ +# Keep existing warnings visible without making all current pull requests fail. +# Raise high-confidence container safety rules to errors so they remain blocking. +failure-threshold: error +override: + error: + - DL3002 + - DL3006 + - DL3007 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e76c7a5..446689a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -55,3 +55,27 @@ repos: hooks: - id: shellcheck args: [-x] + + - repo: local + hooks: + - id: hadolint + name: hadolint + description: Lint Dockerfiles and Containerfiles with Hadolint + language: docker_image + entry: ghcr.io/hadolint/hadolint:v2.15.1 hadolint + types: [dockerfile] + + - id: validate-compose + name: validate compose configurations + description: Validate every supported Docker Compose override combination + language: system + entry: python .github/scripts/validate_compose.py + pass_filenames: false + files: >- + (?x)^( + compose\.yaml| + example\.env| + overrides/compose\..*\.yaml| + tests/compose-configs\.json| + \.github/scripts/validate_compose\.py + )$ diff --git a/docs/08-reference/06-github-actions-image-workflows.md b/docs/08-reference/06-github-actions-image-workflows.md index 85805b6..8e8d909 100644 --- a/docs/08-reference/06-github-actions-image-workflows.md +++ b/docs/08-reference/06-github-actions-image-workflows.md @@ -21,6 +21,7 @@ They decide when the core image pipeline runs. - resolves the image versions for the requested release line - builds the shared core images into a local registry +- scans the locally built images with Trivy - runs the test suite against those images `core-publish-images.yml` is the reusable workflow that: @@ -60,10 +61,11 @@ flowchart TD B[core-build-test-images.yml] C[Resolve versions] D[Build local test images] - E[Run pytest] - F[core-publish-images.yml] - G[Push Docker Hub: erpnext, base, build] - H[Push GHCR: base, build] + E[Scan images with Trivy] + F[Run pytest] + G[core-publish-images.yml] + H[Push Docker Hub: erpnext, base, build] + O[Push GHCR: base, build] A --> B B --> C @@ -71,7 +73,8 @@ flowchart TD D --> E E --> F F --> G - F --> H + G --> H + G --> O end subgraph App["Downstream app flow"] @@ -89,8 +92,8 @@ flowchart TD M --> N end - G --> J H --> J + O --> J ``` More concretely: @@ -99,6 +102,7 @@ More concretely: core-build-test-images.yml -> resolves frappe and erpnext tags -> builds images into a local CI registry + -> scans the locally built images with Trivy -> runs tests core-publish-images.yml diff --git a/docs/08-reference/08-container-validation.md b/docs/08-reference/08-container-validation.md new file mode 100644 index 0000000..2ac9ccf --- /dev/null +++ b/docs/08-reference/08-container-validation.md @@ -0,0 +1,95 @@ +--- +title: Container Validation +--- + +This repository validates its Dockerfiles, supported Compose configurations, and +built container images at different stages of development. + +# Local checks + +The lint workflow runs the repository's pre-commit hooks on every pull request. +Run the same checks locally before committing: + +```shell +pre-commit run --all-files +``` + +To run only the container-related checks: + +```shell +pre-commit run hadolint --all-files +pre-commit run validate-compose --all-files +``` + +The Hadolint hook uses a pinned container image, so it requires a working Docker +daemon. The Compose validator requires Docker Compose, but it only renders the +configuration and does not start containers. + +# Dockerfile linting + +Hadolint checks every Dockerfile and Containerfile through pre-commit and the +existing lint workflow. The policy is defined in `.hadolint.yaml`. + +The initial policy keeps existing warnings visible while only errors fail the +check. It also promotes these high-confidence rules to errors: + +- `DL3002`: the final container user must not be root +- `DL3006`: base images must have an explicit tag +- `DL3007`: base images must not use the `latest` tag + +This allows warnings to be fixed incrementally without making unrelated pull +requests fail immediately. The failure threshold can be tightened after the +existing findings have been addressed. + +# Compose configuration registry + +`tests/compose-configs.json` is the registry of supported Compose combinations. +`.github/scripts/validate_compose.py` renders every entry with `docker compose +config --quiet` and fails if Docker Compose cannot merge the files. + +The validator also checks that every `overrides/compose.*.yaml` file is included +in at least one registered configuration. This keeps adding a new override +simple and makes it difficult to forget its validation case. + +When adding an override: + +1. Add `overrides/compose..yaml`. +2. Add the override to at least one realistic entry in + `tests/compose-configs.json`. +3. Add harmless placeholder values to the entry's `environment` object if the + override introduces required variables that are not in `example.env`. +4. Run `python .github/scripts/validate_compose.py`. + +Configurations are kept in one declarative registry and are evaluated in a +single lint job. This avoids creating a separate GitHub Actions matrix job for +every small Compose combination while preserving matrix-like coverage. + +# Container image scanning + +The core build workflow scans the locally built `base`, `build`, and `erpnext` +images with Trivy for each supported architecture. Reports contain fixed +`HIGH` and `CRITICAL` operating-system and application dependency +vulnerabilities. + +During the initial rollout, Trivy is report-only: + +- findings do not fail the build +- SARIF reports are retained as workflow artifacts for 30 days +- results are uploaded to GitHub Code Scanning for trusted workflow runs +- fork pull requests retain artifacts but skip the Code Scanning upload because + their workflow tokens cannot write security events + +This provides visibility before deciding which vulnerability classes should +become blocking. + +# Proxy image updates + +Dependabot checks the Compose files in `overrides` each week and groups updates +for these externally managed proxy images: + +- `nginxproxy/nginx-proxy` +- `nginxproxy/acme-companion` +- `traefik` + +Database and Redis image versions are intentionally excluded because their +supported versions are defined by the Frappe framework. diff --git a/overrides/compose.nginxproxy-ssl.yaml b/overrides/compose.nginxproxy-ssl.yaml index 4ef0d7f..da1fb79 100644 --- a/overrides/compose.nginxproxy-ssl.yaml +++ b/overrides/compose.nginxproxy-ssl.yaml @@ -11,7 +11,7 @@ services: - ${HTTPS_PUBLISH_PORT:-443}:443 acme-companion: - image: nginxproxy/acme-companion:latest + image: nginxproxy/acme-companion:2.8.2 restart: unless-stopped environment: DEFAULT_EMAIL: ${LETSENCRYPT_EMAIL:?No LETSENCRYPT_EMAIL set} diff --git a/overrides/compose.nginxproxy.yaml b/overrides/compose.nginxproxy.yaml index f1f4ebf..c25ee1a 100644 --- a/overrides/compose.nginxproxy.yaml +++ b/overrides/compose.nginxproxy.yaml @@ -5,7 +5,7 @@ services: VIRTUAL_PORT: 8080 nginx-proxy: - image: nginxproxy/nginx-proxy:alpine + image: nginxproxy/nginx-proxy:1.11.6-alpine restart: unless-stopped ports: - ${HTTP_PUBLISH_PORT:-80}:80 diff --git a/tests/compose-configs.json b/tests/compose-configs.json new file mode 100644 index 0000000..aff67ba --- /dev/null +++ b/tests/compose-configs.json @@ -0,0 +1,142 @@ +{ + "environment": { + "BASE_SITE": "site-one.localhost", + "BENCH_NETWORK": "bench-network", + "DB_PASSWORD_SECRETS_FILE": "./test-db-password.txt", + "EMAIL": "admin@example.com", + "HASHED_PASSWORD": "not-a-real-password-hash", + "ROUTER": "site-one", + "TRAEFIK_DOMAIN": "traefik.example.com" + }, + "configurations": [ + { + "name": "mariadb-no-proxy", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.noproxy.yaml" + ] + }, + { + "name": "mariadb-secrets", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.mariadb-secrets.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.noproxy.yaml" + ] + }, + { + "name": "postgres-no-proxy", + "files": [ + "compose.yaml", + "overrides/compose.postgres.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.noproxy.yaml" + ] + }, + { + "name": "traefik-http", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.proxy.yaml" + ] + }, + { + "name": "traefik-https", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.https.yaml" + ] + }, + { + "name": "nginx-proxy-http", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.nginxproxy.yaml" + ] + }, + { + "name": "nginx-proxy-https", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.nginxproxy.yaml", + "overrides/compose.nginxproxy-ssl.yaml" + ] + }, + { + "name": "migrator", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.proxy.yaml", + "overrides/compose.migrator.yaml" + ] + }, + { + "name": "backup-cron", + "files": [ + "compose.yaml", + "overrides/compose.mariadb.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.proxy.yaml", + "overrides/compose.backup-cron.yaml" + ] + }, + { + "name": "shared-mariadb", + "files": ["overrides/compose.mariadb-shared.yaml"] + }, + { + "name": "standalone-traefik-http", + "files": ["overrides/compose.traefik.yaml"] + }, + { + "name": "standalone-traefik-https", + "files": [ + "overrides/compose.traefik.yaml", + "overrides/compose.traefik-ssl.yaml" + ] + }, + { + "name": "multi-bench-http", + "files": [ + "compose.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.multi-bench.yaml" + ] + }, + { + "name": "multi-bench-https", + "files": [ + "compose.yaml", + "overrides/compose.redis.yaml", + "overrides/compose.multi-bench.yaml", + "overrides/compose.multi-bench-ssl.yaml" + ] + }, + { + "name": "custom-domain-http", + "files": ["compose.yaml", "overrides/compose.custom-domain.yaml"] + }, + { + "name": "custom-domain-https", + "files": [ + "compose.yaml", + "overrides/compose.custom-domain.yaml", + "overrides/compose.custom-domain-ssl.yaml" + ] + } + ] +} From 60803e652aff101442e60cd1fa9e924da6be0e1e Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 16:26:11 +0200 Subject: [PATCH 2/9] ci(security): limit Trivy uploads to main --- .github/workflows/core-build-test-images.yml | 57 +++++++++++++++++--- docs/08-reference/08-container-validation.md | 6 +-- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 934a1ba..150c668 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -153,15 +153,60 @@ jobs: path: trivy-results/*.sarif retention-days: 30 - - name: Upload Trivy results to code scanning + - name: Add Trivy results to pull request summary + if: ${{ always() && github.event_name == 'pull_request' && hashFiles('trivy-results/*.sarif') != '' }} + continue-on-error: true + shell: bash + run: | + python3 - <<'PY' + import json + import os + from pathlib import Path + + maximum_results = 50 + reports = sorted(Path("trivy-results").glob("*.sarif")) + summary_path = Path(os.environ["GITHUB_STEP_SUMMARY"]) + + with summary_path.open("a", encoding="utf-8") as summary: + summary.write("## Trivy image findings\n\n") + for report in reports: + payload = json.loads(report.read_text(encoding="utf-8")) + results = [ + result + for run in payload.get("runs", []) + for result in run.get("results", []) + ] + summary.write(f"### `{report.stem}`: {len(results)} finding(s)\n\n") + if not results: + summary.write("No fixed HIGH or CRITICAL vulnerabilities found.\n\n") + continue + + for result in results[:maximum_results]: + rule = str(result.get("ruleId", "unknown")).replace("`", "") + level = str(result.get("level", "warning")).upper() + message = " ".join( + str(result.get("message", {}).get("text", "No details")) + .replace("`", "") + .split() + ) + summary.write(f"- **{level}** `{rule}`: {message}\n") + + if len(results) > maximum_results: + hidden = len(results) - maximum_results + summary.write( + f"\n{hidden} additional finding(s) are available in the " + "Trivy SARIF artifact.\n" + ) + summary.write("\n") + PY + + - name: Upload Trivy results to code scanning on main if: >- ${{ always() && - hashFiles('trivy-results/*.sarif') != '' && - ( - github.event_name != 'pull_request' || - github.event.pull_request.head.repo.full_name == github.repository - ) + github.event_name == 'push' && + github.ref == 'refs/heads/main' && + hashFiles('trivy-results/*.sarif') != '' }} continue-on-error: true uses: github/codeql-action/upload-sarif@v4 diff --git a/docs/08-reference/08-container-validation.md b/docs/08-reference/08-container-validation.md index 2ac9ccf..20cb558 100644 --- a/docs/08-reference/08-container-validation.md +++ b/docs/08-reference/08-container-validation.md @@ -75,9 +75,9 @@ During the initial rollout, Trivy is report-only: - findings do not fail the build - SARIF reports are retained as workflow artifacts for 30 days -- results are uploaded to GitHub Code Scanning for trusted workflow runs -- fork pull requests retain artifacts but skip the Code Scanning upload because - their workflow tokens cannot write security events +- pull requests show a capped findings list in the workflow summary and retain + the complete SARIF reports as artifacts +- results are uploaded to GitHub Code Scanning only on pushes to `main` This provides visibility before deciding which vulnerability classes should become blocking. From a8ba498e9731ce1fe56ae1f0fc937b3c34a381c2 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 17:45:54 +0200 Subject: [PATCH 3/9] chore(deps): update v15 runtimes --- .github/workflows/core-build-stable.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 39422ed..28eea6b 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -47,8 +47,8 @@ jobs: with: repo: erpnext version: "15" - python_version: 3.11.6 - node_version: 20.19.2 + python_version: 3.11.15 + node_version: 22.23.2 v15_publish: if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} @@ -58,8 +58,8 @@ jobs: repo: erpnext frappe_version: ${{ needs.v15_test.outputs.frappe_version }} erpnext_version: ${{ needs.v15_test.outputs.erpnext_version }} - python_version: 3.11.6 - node_version: 20.19.2 + python_version: 3.11.15 + node_version: 22.23.2 secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} From 176743eeebd5fda675242f3f8aa094fc2a702722 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 17:53:36 +0200 Subject: [PATCH 4/9] chore(deps): track Python 3.11 patches --- .github/workflows/core-build-stable.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 28eea6b..188e023 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -47,7 +47,7 @@ jobs: with: repo: erpnext version: "15" - python_version: 3.11.15 + python_version: "3.11" node_version: 22.23.2 v15_publish: @@ -58,7 +58,7 @@ jobs: repo: erpnext frappe_version: ${{ needs.v15_test.outputs.frappe_version }} erpnext_version: ${{ needs.v15_test.outputs.erpnext_version }} - python_version: 3.11.15 + python_version: "3.11" node_version: 22.23.2 secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} From f932bc52e44969ea0a22d0df7a1a6d7380602b92 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 18:21:02 +0200 Subject: [PATCH 5/9] chore(deps): track supported runtime lines --- .github/workflows/core-build-develop.yml | 10 +++++----- .github/workflows/core-build-stable.yml | 14 +++++++------- .github/workflows/core-build-test-images.yml | 2 +- .github/workflows/lint.yml | 2 +- docker-bake.hcl | 4 ++-- images/bench/Dockerfile | 19 ++++++++++--------- images/custom/Containerfile | 13 +++++++------ images/production/Containerfile | 13 +++++++------ 8 files changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/core-build-develop.yml b/.github/workflows/core-build-develop.yml index 44d214b..cf6a357 100644 --- a/.github/workflows/core-build-develop.yml +++ b/.github/workflows/core-build-develop.yml @@ -23,7 +23,7 @@ on: - .github/workflows/core-publish-images.yml schedule: - # Every day at 12:00 pm + # Every day at 00:00 UTC - cron: 0 0 * * * workflow_dispatch: @@ -34,8 +34,8 @@ jobs: with: repo: erpnext version: develop - python_version: 3.14.2 - node_version: 24.12.0 + python_version: "3.14" + node_version: "24" publish: if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} @@ -45,8 +45,8 @@ jobs: repo: erpnext frappe_version: ${{ needs.test.outputs.frappe_version }} erpnext_version: ${{ needs.test.outputs.erpnext_version }} - python_version: 3.14.2 - node_version: 24.12.0 + python_version: "3.14" + node_version: "24" secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 188e023..675c480 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -48,7 +48,7 @@ jobs: repo: erpnext version: "15" python_version: "3.11" - node_version: 22.23.2 + node_version: "22" v15_publish: if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} @@ -59,7 +59,7 @@ jobs: frappe_version: ${{ needs.v15_test.outputs.frappe_version }} erpnext_version: ${{ needs.v15_test.outputs.erpnext_version }} python_version: "3.11" - node_version: 22.23.2 + node_version: "22" secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} @@ -69,8 +69,8 @@ jobs: with: repo: erpnext version: "16" - python_version: 3.14.2 - node_version: 24.12.0 + python_version: "3.14" + node_version: "24" v16_publish: if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} needs: v16_test @@ -79,8 +79,8 @@ jobs: repo: erpnext frappe_version: ${{ needs.v16_test.outputs.frappe_version }} erpnext_version: ${{ needs.v16_test.outputs.erpnext_version }} - python_version: 3.14.2 - node_version: 24.12.0 + python_version: "3.14" + node_version: "24" secrets: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} @@ -100,7 +100,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v7 with: - python-version: "3.14.2" + python-version: "3.14" - name: Get latest versions run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version 16 diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 150c668..207a083 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -217,7 +217,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v7 with: - python-version: "3.10" + python-version: "3.14" - name: Install dependencies run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4df7e5a..8ff6329 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v7 with: - python-version: "3.10.6" + python-version: "3.14" # For shfmt pre-commit hook - name: Setup Go diff --git a/docker-bake.hcl b/docker-bake.hcl index cb59f83..3572755 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -6,10 +6,10 @@ variable "REGISTRY_USER" { } variable PYTHON_VERSION { - default = "3.14.2" + default = "3.14" } variable NODE_VERSION { - default = "24.13.0" + default = "24" } variable "FRAPPE_VERSION" { diff --git a/images/bench/Dockerfile b/images/bench/Dockerfile index 2b2540b..61fd67c 100644 --- a/images/bench/Dockerfile +++ b/images/bench/Dockerfile @@ -105,8 +105,8 @@ USER frappe WORKDIR /home/frappe # Install Python via pyenv -ENV PYTHON_VERSION_PREV=3.12.12 -ENV PYTHON_VERSION=3.14.2 +ENV PYTHON_VERSION_PREV=3.12 +ENV PYTHON_VERSION=3.14 ENV PYENV_ROOT=/home/frappe/.pyenv ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH @@ -132,20 +132,21 @@ RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \ && echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc # Install Node via nvm -ENV NODE_VERSION_PREV=22.22.0 -ENV NODE_VERSION=24.13.0 +ENV NODE_VERSION_PREV=22 +ENV NODE_VERSION=24 ENV NVM_DIR=/home/frappe/.nvm -ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin/:${PATH} -RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ +RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bash \ && . ${NVM_DIR}/nvm.sh \ && nvm install ${NODE_VERSION_PREV} \ - && nvm use v${NODE_VERSION_PREV} \ + && nvm use ${NODE_VERSION_PREV} \ && npm install -g yarn \ && nvm install ${NODE_VERSION} \ - && nvm use v${NODE_VERSION} \ + && nvm use ${NODE_VERSION} \ && npm install -g yarn \ - && nvm alias default v${NODE_VERSION} \ + && nvm alias default ${NODE_VERSION} \ && rm -rf ${NVM_DIR}/.cache \ && echo 'export NVM_DIR="/home/frappe/.nvm"' >>~/.bashrc \ && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ diff --git a/images/custom/Containerfile b/images/custom/Containerfile index 70e4317..5dd987c 100644 --- a/images/custom/Containerfile +++ b/images/custom/Containerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.14.2 +ARG PYTHON_VERSION=3.14 ARG DEBIAN_BASE=bookworm FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base @@ -10,9 +10,10 @@ ARG WKHTMLTOPDF_VERSION=0.12.6.1-3 ARG WKHTMLTOPDF_DISTRO=bookworm ARG INSTALL_CHROMIUM=true -ARG NODE_VERSION=24.13.0 +ARG NODE_VERSION=24 ENV NVM_DIR=/home/frappe/.nvm -ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin/:${PATH} RUN useradd -ms /bin/bash frappe \ && apt-get update \ @@ -44,13 +45,13 @@ RUN useradd -ms /bin/bash frappe \ media-types \ # NodeJS && mkdir -p ${NVM_DIR} \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bash \ && . ${NVM_DIR}/nvm.sh \ && nvm install ${NODE_VERSION} \ - && nvm use v${NODE_VERSION} \ + && nvm use ${NODE_VERSION} \ && npm install -g yarn \ && corepack enable pnpm \ - && nvm alias default v${NODE_VERSION} \ + && nvm alias default ${NODE_VERSION} \ && rm -rf ${NVM_DIR}/.cache \ && echo 'export NVM_DIR="/home/frappe/.nvm"' >>/home/frappe/.bashrc \ && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >>/home/frappe/.bashrc \ diff --git a/images/production/Containerfile b/images/production/Containerfile index b30dd95..83bf302 100644 --- a/images/production/Containerfile +++ b/images/production/Containerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.14.2 +ARG PYTHON_VERSION=3.14 ARG DEBIAN_BASE=bookworm FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base @@ -6,9 +6,10 @@ ARG WKHTMLTOPDF_VERSION=0.12.6.1-3 ARG WKHTMLTOPDF_DISTRO=bookworm ARG INSTALL_CHROMIUM=true -ARG NODE_VERSION=24.13.0 +ARG NODE_VERSION=24 ENV NVM_DIR=/home/frappe/.nvm -ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin/:${PATH} RUN useradd -ms /bin/bash frappe \ && apt-get update \ @@ -40,13 +41,13 @@ RUN useradd -ms /bin/bash frappe \ media-types \ # NodeJS && mkdir -p ${NVM_DIR} \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.6/install.sh | bash \ && . ${NVM_DIR}/nvm.sh \ && nvm install ${NODE_VERSION} \ - && nvm use v${NODE_VERSION} \ + && nvm use ${NODE_VERSION} \ && npm install -g yarn \ && corepack enable pnpm \ - && nvm alias default v${NODE_VERSION} \ + && nvm alias default ${NODE_VERSION} \ && rm -rf ${NVM_DIR}/.cache \ && echo 'export NVM_DIR="/home/frappe/.nvm"' >>/home/frappe/.bashrc \ && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >>/home/frappe/.bashrc \ From af3065c5a726880d380bbf6c2c93f242bf3041e1 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 18:21:39 +0200 Subject: [PATCH 6/9] ci(security): schedule published image scans --- .github/workflows/security-scan-images.yml | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 .github/workflows/security-scan-images.yml diff --git a/.github/workflows/security-scan-images.yml b/.github/workflows/security-scan-images.yml new file mode 100644 index 0000000..344dbdb --- /dev/null +++ b/.github/workflows/security-scan-images.yml @@ -0,0 +1,104 @@ +name: Security / Scan Published Images + +permissions: + contents: read + security-events: write + +on: + schedule: + # Every Monday at 03:17 UTC + - cron: "17 3 * * 1" + + workflow_dispatch: + +jobs: + scan: + name: Version ${{ matrix.version }} / ${{ matrix.arch }} + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + version: ["15", "16"] + arch: [amd64, arm64] + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Resolve published image versions + run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version ${{ matrix.version }} + + - name: Pull published images + run: | + docker pull --platform linux/${{ matrix.arch }} frappe/base:${FRAPPE_VERSION} + docker pull --platform linux/${{ matrix.arch }} frappe/build:${ERPNEXT_VERSION} + docker pull --platform linux/${{ matrix.arch }} frappe/erpnext:${ERPNEXT_VERSION} + + - name: Create Trivy report directory + run: mkdir -p trivy-results + + - name: Scan base image + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: frappe/base:${{ env.FRAPPE_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/base.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + + - name: Scan build image + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: frappe/build:${{ env.ERPNEXT_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/build.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + skip-setup-trivy: true + + - name: Scan ERPNext image + uses: aquasecurity/trivy-action@v0.36.0 + with: + image-ref: frappe/erpnext:${{ env.ERPNEXT_VERSION }} + scanners: vuln + format: sarif + output: trivy-results/erpnext.sarif + severity: HIGH,CRITICAL + ignore-unfixed: true + limit-severities-for-sarif: true + exit-code: 0 + skip-setup-trivy: true + + - name: Add Trivy result counts to summary + if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} + shell: bash + run: | + echo "## Trivy image findings" >> "$GITHUB_STEP_SUMMARY" + echo >> "$GITHUB_STEP_SUMMARY" + for report in trivy-results/*.sarif; do + image="$(basename "$report" .sarif)" + findings="$(jq '[.runs[]?.results[]?] | length' "$report")" + echo "- **${image}:** ${findings} finding(s)" >> "$GITHUB_STEP_SUMMARY" + done + + - name: Upload Trivy report artifact + if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} + uses: actions/upload-artifact@v4 + with: + name: trivy-${{ matrix.version }}-${{ matrix.arch }} + path: trivy-results/*.sarif + retention-days: 30 + + - name: Upload Trivy results to code scanning + if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} + uses: github/codeql-action/upload-sarif@v4 + with: + sarif_file: trivy-results + category: trivy-${{ matrix.version }}-${{ matrix.arch }} From 810a7285e9edae7d9a628d6f906c91609bb72712 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 18:27:14 +0200 Subject: [PATCH 7/9] refactor(ci): reuse stable image scans --- .github/workflows/core-build-stable.yml | 25 ++++- .github/workflows/core-build-test-images.yml | 2 +- .github/workflows/security-scan-images.yml | 104 ------------------- 3 files changed, 23 insertions(+), 108 deletions(-) delete mode 100644 .github/workflows/security-scan-images.yml diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 675c480..a1bf344 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -36,6 +36,10 @@ on: - .github/workflows/core-build-test-images.yml - .github/workflows/core-publish-images.yml + schedule: + # Every Monday at 03:17 UTC + - cron: "17 3 * * 1" + # Triggered from frappe/frappe and frappe/erpnext on releases repository_dispatch: @@ -51,7 +55,12 @@ jobs: node_version: "22" v15_publish: - if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} + if: >- + ${{ + github.repository == 'frappe/frappe_docker' && + github.event_name != 'pull_request' && + github.event_name != 'schedule' + }} needs: v15_test uses: ./.github/workflows/core-publish-images.yml with: @@ -72,7 +81,12 @@ jobs: python_version: "3.14" node_version: "24" v16_publish: - if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} + if: >- + ${{ + github.repository == 'frappe/frappe_docker' && + github.event_name != 'pull_request' && + github.event_name != 'schedule' + }} needs: v16_test uses: ./.github/workflows/core-publish-images.yml with: @@ -88,7 +102,12 @@ jobs: update_versions: name: Update example.env and pwd.yml runs-on: ubuntu-latest - if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} + if: >- + ${{ + github.repository == 'frappe/frappe_docker' && + github.event_name != 'pull_request' && + github.event_name != 'schedule' + }} needs: v16_publish permissions: contents: write diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 207a083..f580365 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -204,8 +204,8 @@ jobs: if: >- ${{ always() && - github.event_name == 'push' && github.ref == 'refs/heads/main' && + (github.event_name == 'push' || github.event_name == 'schedule') && hashFiles('trivy-results/*.sarif') != '' }} continue-on-error: true diff --git a/.github/workflows/security-scan-images.yml b/.github/workflows/security-scan-images.yml deleted file mode 100644 index 344dbdb..0000000 --- a/.github/workflows/security-scan-images.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Security / Scan Published Images - -permissions: - contents: read - security-events: write - -on: - schedule: - # Every Monday at 03:17 UTC - - cron: "17 3 * * 1" - - workflow_dispatch: - -jobs: - scan: - name: Version ${{ matrix.version }} / ${{ matrix.arch }} - runs-on: ubuntu-latest - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - version: ["15", "16"] - arch: [amd64, arm64] - - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Resolve published image versions - run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version ${{ matrix.version }} - - - name: Pull published images - run: | - docker pull --platform linux/${{ matrix.arch }} frappe/base:${FRAPPE_VERSION} - docker pull --platform linux/${{ matrix.arch }} frappe/build:${ERPNEXT_VERSION} - docker pull --platform linux/${{ matrix.arch }} frappe/erpnext:${ERPNEXT_VERSION} - - - name: Create Trivy report directory - run: mkdir -p trivy-results - - - name: Scan base image - uses: aquasecurity/trivy-action@v0.36.0 - with: - image-ref: frappe/base:${{ env.FRAPPE_VERSION }} - scanners: vuln - format: sarif - output: trivy-results/base.sarif - severity: HIGH,CRITICAL - ignore-unfixed: true - limit-severities-for-sarif: true - exit-code: 0 - - - name: Scan build image - uses: aquasecurity/trivy-action@v0.36.0 - with: - image-ref: frappe/build:${{ env.ERPNEXT_VERSION }} - scanners: vuln - format: sarif - output: trivy-results/build.sarif - severity: HIGH,CRITICAL - ignore-unfixed: true - limit-severities-for-sarif: true - exit-code: 0 - skip-setup-trivy: true - - - name: Scan ERPNext image - uses: aquasecurity/trivy-action@v0.36.0 - with: - image-ref: frappe/erpnext:${{ env.ERPNEXT_VERSION }} - scanners: vuln - format: sarif - output: trivy-results/erpnext.sarif - severity: HIGH,CRITICAL - ignore-unfixed: true - limit-severities-for-sarif: true - exit-code: 0 - skip-setup-trivy: true - - - name: Add Trivy result counts to summary - if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} - shell: bash - run: | - echo "## Trivy image findings" >> "$GITHUB_STEP_SUMMARY" - echo >> "$GITHUB_STEP_SUMMARY" - for report in trivy-results/*.sarif; do - image="$(basename "$report" .sarif)" - findings="$(jq '[.runs[]?.results[]?] | length' "$report")" - echo "- **${image}:** ${findings} finding(s)" >> "$GITHUB_STEP_SUMMARY" - done - - - name: Upload Trivy report artifact - if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} - uses: actions/upload-artifact@v4 - with: - name: trivy-${{ matrix.version }}-${{ matrix.arch }} - path: trivy-results/*.sarif - retention-days: 30 - - - name: Upload Trivy results to code scanning - if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }} - uses: github/codeql-action/upload-sarif@v4 - with: - sarif_file: trivy-results - category: trivy-${{ matrix.version }}-${{ matrix.arch }} From f706f3a402effabf09abb071f5a50317e03fd7fe Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 18:35:44 +0200 Subject: [PATCH 8/9] ci(security): consolidate scheduled image scans --- .github/workflows/core-build-develop.yml | 4 ++-- .github/workflows/core-build-stable.yml | 25 +++--------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/core-build-develop.yml b/.github/workflows/core-build-develop.yml index cf6a357..d8903c5 100644 --- a/.github/workflows/core-build-develop.yml +++ b/.github/workflows/core-build-develop.yml @@ -23,8 +23,8 @@ on: - .github/workflows/core-publish-images.yml schedule: - # Every day at 00:00 UTC - - cron: 0 0 * * * + # Every Monday at 03:17 UTC + - cron: "17 3 * * 1" workflow_dispatch: diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index a1bf344..675c480 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -36,10 +36,6 @@ on: - .github/workflows/core-build-test-images.yml - .github/workflows/core-publish-images.yml - schedule: - # Every Monday at 03:17 UTC - - cron: "17 3 * * 1" - # Triggered from frappe/frappe and frappe/erpnext on releases repository_dispatch: @@ -55,12 +51,7 @@ jobs: node_version: "22" v15_publish: - if: >- - ${{ - github.repository == 'frappe/frappe_docker' && - github.event_name != 'pull_request' && - github.event_name != 'schedule' - }} + if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} needs: v15_test uses: ./.github/workflows/core-publish-images.yml with: @@ -81,12 +72,7 @@ jobs: python_version: "3.14" node_version: "24" v16_publish: - if: >- - ${{ - github.repository == 'frappe/frappe_docker' && - github.event_name != 'pull_request' && - github.event_name != 'schedule' - }} + if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} needs: v16_test uses: ./.github/workflows/core-publish-images.yml with: @@ -102,12 +88,7 @@ jobs: update_versions: name: Update example.env and pwd.yml runs-on: ubuntu-latest - if: >- - ${{ - github.repository == 'frappe/frappe_docker' && - github.event_name != 'pull_request' && - github.event_name != 'schedule' - }} + if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }} needs: v16_publish permissions: contents: write From 12dadba5a896adcfa6a0e67b1ad224fc867bed93 Mon Sep 17 00:00:00 2001 From: Daniel Radl Date: Thu, 20 Aug 2026 19:25:33 +0200 Subject: [PATCH 9/9] ci(security): narrow Trivy code scanning upload --- .github/workflows/core-build-test-images.yml | 12 +++++++----- docs/08-reference/08-container-validation.md | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index f580365..fa4d69f 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -200,19 +200,21 @@ jobs: summary.write("\n") PY - - name: Upload Trivy results to code scanning on main + - name: Upload v16 amd64 build results to code scanning on main if: >- ${{ always() && + inputs.version == '16' && + matrix.arch == 'amd64' && github.ref == 'refs/heads/main' && - (github.event_name == 'push' || github.event_name == 'schedule') && - hashFiles('trivy-results/*.sarif') != '' + github.event_name == 'push' && + hashFiles('trivy-results/build.sarif') != '' }} continue-on-error: true uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: trivy-results - category: trivy-${{ inputs.version }}-${{ matrix.arch }} + sarif_file: trivy-results/build.sarif + category: trivy-v16-amd64-build - name: Setup Python uses: actions/setup-python@v7 diff --git a/docs/08-reference/08-container-validation.md b/docs/08-reference/08-container-validation.md index 20cb558..8f42ceb 100644 --- a/docs/08-reference/08-container-validation.md +++ b/docs/08-reference/08-container-validation.md @@ -77,7 +77,9 @@ During the initial rollout, Trivy is report-only: - SARIF reports are retained as workflow artifacts for 30 days - pull requests show a capped findings list in the workflow summary and retain the complete SARIF reports as artifacts -- results are uploaded to GitHub Code Scanning only on pushes to `main` +- only the version 16 AMD64 `build` image report is uploaded to GitHub Code + Scanning, and only on pushes to `main`; complete reports for every image and + architecture remain available as workflow artifacts This provides visibility before deciding which vulnerability classes should become blocking.