diff --git a/.github/dependency-review.yml b/.github/dependency-review.yml new file mode 100644 index 0000000..1ce12ce --- /dev/null +++ b/.github/dependency-review.yml @@ -0,0 +1,19 @@ +# Read from main by every caller of shared-checks.yml. + +# Every dependency's licence may be combined with GPL-3.0 code that is distributed (public Docker images). +# Missing on purpose, so they fail and need a decision: AGPL-3.0, proprietary and source-available +# licences, non-commercial ones, and GPL-incompatible copyleft (EPL, CDDL, GPL-2.0-only). +# LicenseRef-scancode-protobuf is ScanCode's ID for protobuf's licence: BSD-3-Clause plus a note on generated code. +allow-licenses: >- + MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, Zlib, BSL-1.0, Unlicense, CC0-1.0, + WTFPL, BlueOak-1.0.0, Python-2.0, PSF-2.0, Artistic-2.0, Unicode-3.0, Unicode-DFS-2016, HPND-Markus-Kuhn, + BSD-2-Clause-Views, + MPL-2.0, LGPL-2.1-only, LGPL-2.1-or-later, LGPL-3.0-only, LGPL-3.0-or-later, + GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later, + CC-BY-3.0, CC-BY-4.0, OFL-1.1, + LicenseRef-scancode-protobuf + +# Packages whose licence the policy excludes but whose use here it permits, matched by name across all versions. +allow-dependencies-licenses: + # FSL-1.1-Apache-2.0 forbids only competing with Sentry. Build-time CLI of @sentry/bundler-plugins: no image may ship it. + - pkg:npm/sentry diff --git a/.github/workflows/shared-checks.yml b/.github/workflows/shared-checks.yml index b182e84..9ad04be 100644 --- a/.github/workflows/shared-checks.yml +++ b/.github/workflows/shared-checks.yml @@ -36,15 +36,6 @@ jobs: - name: Review dependency changes uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 with: - # Every dependency's licence may be combined with GPL-3.0 code that is distributed (public Docker images). - # Missing on purpose, so they fail and need a decision: AGPL-3.0, proprietary and source-available - # licences, non-commercial ones, and GPL-incompatible copyleft (EPL, CDDL, GPL-2.0-only). - # LicenseRef-scancode-protobuf is ScanCode's ID for protobuf's licence: BSD-3-Clause plus a note on generated code. - allow-licenses: >- - MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, Zlib, BSL-1.0, Unlicense, CC0-1.0, - WTFPL, BlueOak-1.0.0, Python-2.0, PSF-2.0, Artistic-2.0, Unicode-3.0, Unicode-DFS-2016, HPND-Markus-Kuhn, - BSD-2-Clause-Views, - MPL-2.0, LGPL-2.1-only, LGPL-2.1-or-later, LGPL-3.0-only, LGPL-3.0-or-later, - GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later, - CC-BY-3.0, CC-BY-4.0, OFL-1.1, - LicenseRef-scancode-protobuf + config-file: BSStudio/.github/.github/dependency-review.yml@main + # The file is public, but unauthenticated requests share the runner's per-IP rate limit. + external-repo-token: ${{ github.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4b2565..aabce1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,3 +34,19 @@ jobs: - name: Run tests run: node --test "scripts/*.test.mjs" + + licence-policy: + name: Licence policy + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Check out + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Review dependency changes against the policy + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 + with: + config-file: ./.github/dependency-review.yml diff --git a/CLAUDE.md b/CLAUDE.md index 2965d4a..a901126 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,7 +8,7 @@ Organisation-wide defaults for Budavári Schönherz Stúdió's GitHub repositori node --test "scripts/*.test.mjs" ``` -This repository's own `checks.yml` calls `shared-checks.yml` from the same commit, so the PR runs any change to the checks against this repository first, except the Dependencies job, which this repository doesn't enable. +This repository's own `checks.yml` calls `shared-checks.yml` from the same commit, so the PR runs any change to the checks against this repository first, except the Dependencies job, which this repository doesn't enable. Instead, the Test workflow's `Licence policy` job runs the dependency review with the PR's own `.github/dependency-review.yml`. ## Commits and branches @@ -19,5 +19,5 @@ Commit messages and PR titles are plain imperative sentences. PRs are squash-mer - Live GitHub settings change only when asked: `scripts/apply-settings.mjs` and `scripts/apply-ruleset.mjs` write to the organisation's repos, so otherwise run them with `--dry-run` only. - A repo added to `settings/repos.json` also needs the "BSStudio settings check" GitHub App installed on it, which you can't do: tell the user. - `docs/workflows.md` and `scripts/workflow-style.mjs` stay in step: a change to the convention goes in together with the checker change that enforces it. -- A change to the shared checks reaches other repos only through a release: callers pin `shared-checks.yml` by the release commit's SHA with a `# vX.Y.Z` comment, and Renovate opens a PR in each caller for the new pin. The job names (`Workflows`, `Dependencies`) and the `dependency-review` input are an interface: every repo's ruleset requires `Checks / Workflows` by name, so renaming either blocks those PRs until every caller and ruleset is updated. +- A change to the shared checks reaches other repos only through a release: callers pin `shared-checks.yml` by the release commit's SHA with a `# vX.Y.Z` comment, and Renovate opens a PR in each caller for the new pin. The exception is the licence policy, `.github/dependency-review.yml`: every caller reads it from `main`, so a change applies to every repo as soon as it merges, and the file keeps its path, and `main` its name, while any release still references them. The job names (`Workflows`, `Dependencies`) and the `dependency-review` input are an interface: every repo's ruleset requires `Checks / Workflows` by name, so renaming either blocks those PRs until every caller and ruleset is updated. - Files in `assets/` keep their paths: other repos' READMEs embed them from `https://raw.githubusercontent.com/BSStudio/.github/main/assets/`. diff --git a/README.md b/README.md index 7788631..bc0fa87 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,4 @@ Security features (secret scanning, push protection, Dependabot alerts, CodeQL d Every workflow follows one convention, written down in [`docs/workflows.md`](docs/workflows.md). Each repo enforces it with a `.github/workflows/checks.yml` that calls `.github/workflows/shared-checks.yml` here (the copyable caller is in the convention): `Checks / Workflows` runs actionlint, zizmor and `scripts/check-workflows.mjs` over the repo's workflows and composite actions, and `Checks / Dependencies` reviews new dependencies for vulnerabilities and licences in repos that turn it on. Wherever a ruleset exists it requires `Checks / Workflows`, plus `Checks / Dependencies` where the review is on. -Callers pin a tagged release of this repo; Renovate proposes each new release. The checks run from the same commit as the workflow that calls them: `shared-checks.yml` reaches its composite action through the `$/` self-repository syntax. +Callers pin a tagged release of this repo; Renovate proposes each new release. The licence policy in `.github/dependency-review.yml` is the exception: `Checks / Dependencies` reads it from `main`, so allowing a licence or exempting a package needs no release. The `Licence policy` check runs each PR's version of the file here first. The checks run from the same commit as the workflow that calls them: `shared-checks.yml` reaches its composite action through the `$/` self-repository syntax. diff --git a/docs/workflows.md b/docs/workflows.md index e7068af..05e6fb1 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -75,8 +75,8 @@ jobs: ``` - The job must be named `Checks`: the checks then report as `Checks / Workflows` and `Checks / Dependencies`, the names the repository's ruleset requires. -- `dependency-review: true` adds the dependency review for repositories with package manifests. It works on public repositories only and checks every new or changed dependency for known vulnerabilities and for a licence outside the allow-list in `shared-checks.yml`. Without the input the `Dependencies` job is skipped, which still satisfies a required check. -- The pin follows this repository's releases: Renovate proposes each new release in every caller, and that pull request runs the new checks against the repository before anything merges. +- `dependency-review: true` adds the dependency review for repositories with package manifests. It works on public repositories only and checks every new or changed dependency for known vulnerabilities and for a licence outside the licence policy in `.github/dependency-review.yml`. Without the input the `Dependencies` job is skipped, which still satisfies a required check. +- The pin follows this repository's releases: Renovate proposes each new release in every caller, and that pull request runs the new checks against the repository before anything merges. The licence policy is the exception: every caller reads it from this repository's `main`, so a change to it applies on the next run, and re-running a failed `Checks / Dependencies` picks it up. ## Running the checks locally