From 816e5ac6213786e354f665e501cb2fb450d58f2d Mon Sep 17 00:00:00 2001 From: smarcet Date: Mon, 23 Nov 2026 13:15:09 -0300 Subject: [PATCH 1/4] chore(ci): add Dependabot updates, a dependency audit and the patch record template Dependabot version updates for Composer, npm and the Dockerfile, monthly. A Dependency Audit workflow: dependency review fails a pull request that introduces a high or critical vulnerability, and composer audit and yarn audit report on the whole lock files without blocking yet. Release note categories and the patch record template for releases. --- .github/RELEASE_NOTES_TEMPLATE.md | 15 +++++++ .github/dependabot.yml | 39 +++++++++++++++++ .github/release.yml | 11 +++++ .github/workflows/dependency_audit.yml | 60 ++++++++++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 .github/RELEASE_NOTES_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/dependency_audit.yml diff --git a/.github/RELEASE_NOTES_TEMPLATE.md b/.github/RELEASE_NOTES_TEMPLATE.md new file mode 100644 index 00000000..5e26b726 --- /dev/null +++ b/.github/RELEASE_NOTES_TEMPLATE.md @@ -0,0 +1,15 @@ + + +## Patch record + +- Release tag: vX.Y.Z +- Deployed to production: YYYY-MM-DD +- Components updated: see "Dependency updates" below +- CVEs and advisories addressed: none diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d5a18826 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,39 @@ +# Dependabot version updates. +# +# Update pull requests are opened on the first day of each month, so they are ready +# for the monthly patch cycle. Minor and patch updates are grouped into one pull +# request per ecosystem; a major update gets its own pull request. +# +# Security alerts do not depend on this file: they are a repository setting. +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 5 + groups: + composer-minor-and-patch: + patterns: + - "*" + update-types: + - "minor" + - "patch" + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + open-pull-requests-limit: 5 + groups: + npm-minor-and-patch: + patterns: + - "*" + update-types: + - "minor" + - "patch" + + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..eb4f05bf --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,11 @@ +# Categories for automatically generated release notes. +# Dependabot labels its pull requests "dependencies", so the components that a +# release updates are listed on their own for the patch record. +changelog: + categories: + - title: Dependency updates + labels: + - dependencies + - title: Other changes + labels: + - "*" diff --git a/.github/workflows/dependency_audit.yml b/.github/workflows/dependency_audit.yml new file mode 100644 index 00000000..3bb44da0 --- /dev/null +++ b/.github/workflows/dependency_audit.yml @@ -0,0 +1,60 @@ +name: Dependency Audit + +on: + pull_request: + branches: [ "main" ] + schedule: + - cron: '0 6 * * 1' # Mondays at 06:00 UTC + workflow_dispatch: + +permissions: + contents: read + +jobs: + # Blocks a pull request that adds a dependency, or updates one to a version, + # with a known vulnerability of high or critical severity. + dependency-review: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Review dependency changes + uses: actions/dependency-review-action@v5.0.1 + with: + fail-on-severity: high + + # Audits every dependency in the lock files. + # Report only for now: main still has advisories that predate this workflow, so + # a blocking audit would fail every pull request. Remove the two + # "continue-on-error" lines once those advisories are patched or accepted. + audit: + runs-on: ubuntu-latest + env: + PHP_VERSION: 8.3 + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Install PHP + uses: "shivammathur/setup-php@v2" + with: + php-version: ${{env.PHP_VERSION}} + tools: composer:v2 + coverage: none + - name: Composer audit + continue-on-error: true + run: composer audit --locked --abandoned=report --ignore-severity=low --ignore-severity=medium + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: '22' + - name: Yarn audit (runtime dependencies) + continue-on-error: true + run: | + set +e + yarn audit --groups dependencies --level high + code=$? + # yarn 1 returns a bit mask: 8 = high, 16 = critical + if [ $((code & 24)) -ne 0 ]; then + exit 1 + fi From 3f5186ea56b9a5f8e57e032ebbbec537b0a050c4 Mon Sep 17 00:00:00 2001 From: smarcet Date: Mon, 23 Nov 2026 13:57:22 -0300 Subject: [PATCH 2/4] fix(ci): review development dependencies and detect a failed yarn audit Dependency review now fails on runtime, development and unknown scopes; its default covers runtime only. The yarn audit step reads the JSON summary, because yarn 1 exits 1 both when the audit fails to run and when it only finds info-level advisories. The release notes template asks for the packages of grouped Dependabot pull requests, which the generated notes list only by group name. --- .github/RELEASE_NOTES_TEMPLATE.md | 2 +- .github/workflows/dependency_audit.yml | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/RELEASE_NOTES_TEMPLATE.md b/.github/RELEASE_NOTES_TEMPLATE.md index 5e26b726..5aba9db5 100644 --- a/.github/RELEASE_NOTES_TEMPLATE.md +++ b/.github/RELEASE_NOTES_TEMPLATE.md @@ -11,5 +11,5 @@ release is running in production. - Release tag: vX.Y.Z - Deployed to production: YYYY-MM-DD -- Components updated: see "Dependency updates" below +- Components updated: list them here. A grouped Dependabot pull request shows only its group name under "Dependency updates", so copy the packages from its description. - CVEs and advisories addressed: none diff --git a/.github/workflows/dependency_audit.yml b/.github/workflows/dependency_audit.yml index 3bb44da0..9523c547 100644 --- a/.github/workflows/dependency_audit.yml +++ b/.github/workflows/dependency_audit.yml @@ -23,6 +23,8 @@ jobs: uses: actions/dependency-review-action@v5.0.1 with: fail-on-severity: high + # The default covers runtime dependencies only. + fail-on-scopes: runtime, development, unknown # Audits every dependency in the lock files. # Report only for now: main still has advisories that predate this workflow, so @@ -52,9 +54,17 @@ jobs: continue-on-error: true run: | set +e - yarn audit --groups dependencies --level high - code=$? - # yarn 1 returns a bit mask: 8 = high, 16 = critical - if [ $((code & 24)) -ne 0 ]; then + # The exit code of yarn 1 cannot tell a failed audit from a clean one + # (both can be 1), so the result is read from the JSON summary. + yarn audit --groups dependencies --json > yarn-audit.jsonl + summary=$(jq -c 'select(.type == "auditSummary") | .data.vulnerabilities' yarn-audit.jsonl | tail -n 1) + if [ -z "$summary" ]; then + echo "yarn audit did not complete:" + head -n 20 yarn-audit.jsonl + exit 1 + fi + echo "Vulnerabilities by severity: $summary" + if [ "$(echo "$summary" | jq '.high + .critical')" -gt 0 ]; then + yarn audit --groups dependencies --level high exit 1 fi From ffda39c1855a66c9220ef244a8b3541f027dcee4 Mon Sep 17 00:00:00 2001 From: smarcet Date: Mon, 23 Nov 2026 14:32:23 -0300 Subject: [PATCH 3/4] fix(ci): audit every yarn group, not only dependencies The frontend is bundled, and packages declared under devDependencies (react, react-dom, superagent, urijs) are imported by resources/js and ship to the browser. The dependencies filter left them out of the report. --- .github/workflows/dependency_audit.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependency_audit.yml b/.github/workflows/dependency_audit.yml index 9523c547..6830d2db 100644 --- a/.github/workflows/dependency_audit.yml +++ b/.github/workflows/dependency_audit.yml @@ -50,13 +50,15 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' - - name: Yarn audit (runtime dependencies) + # Every group is audited: the frontend is bundled, so packages declared + # under devDependencies (react, superagent) also ship to the browser. + - name: Yarn audit continue-on-error: true run: | set +e # The exit code of yarn 1 cannot tell a failed audit from a clean one # (both can be 1), so the result is read from the JSON summary. - yarn audit --groups dependencies --json > yarn-audit.jsonl + yarn audit --json > yarn-audit.jsonl summary=$(jq -c 'select(.type == "auditSummary") | .data.vulnerabilities' yarn-audit.jsonl | tail -n 1) if [ -z "$summary" ]; then echo "yarn audit did not complete:" @@ -65,6 +67,6 @@ jobs: fi echo "Vulnerabilities by severity: $summary" if [ "$(echo "$summary" | jq '.high + .critical')" -gt 0 ]; then - yarn audit --groups dependencies --level high + yarn audit --level high exit 1 fi From 69bbfe250bc387297948fcc8943b4381397e0628 Mon Sep 17 00:00:00 2001 From: smarcet Date: Mon, 23 Nov 2026 16:44:07 -0300 Subject: [PATCH 4/4] ci: make the composer audit blocking main has no Composer advisories since #191, so the audit step no longer needs continue-on-error. The Yarn audit stays report only while the npm advisories are open. --- .github/workflows/dependency_audit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependency_audit.yml b/.github/workflows/dependency_audit.yml index 6830d2db..f3ea8c3f 100644 --- a/.github/workflows/dependency_audit.yml +++ b/.github/workflows/dependency_audit.yml @@ -27,9 +27,10 @@ jobs: fail-on-scopes: runtime, development, unknown # Audits every dependency in the lock files. - # Report only for now: main still has advisories that predate this workflow, so - # a blocking audit would fail every pull request. Remove the two - # "continue-on-error" lines once those advisories are patched or accepted. + # The Composer audit blocks. The Yarn audit only reports for now: main still + # has npm advisories that predate this workflow, so a blocking audit would + # fail every pull request. Remove its "continue-on-error" line once those + # advisories are patched or accepted. audit: runs-on: ubuntu-latest env: @@ -44,7 +45,6 @@ jobs: tools: composer:v2 coverage: none - name: Composer audit - continue-on-error: true run: composer audit --locked --abandoned=report --ignore-severity=low --ignore-severity=medium - name: Install Node uses: actions/setup-node@v4