Repository navigation
Enforce severity and license gates in dependency-review workflow - #182
AndreasIgel merged 4 commits into
Conversation
Enable fail-on-severity (high), deny-licenses (GPL/LGPL/AGPL family, incompatible with this MIT project) and retry-on-snapshot-warnings in the Dependency Review action so PRs introducing vulnerable or incompatibly-licensed dependencies are blocked, not just commented on. Refs java-helpers#160 Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
What about licenses not recognized, we have some here which are Not recognized right? |
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
|
Answered here + fixed the fork limitation. Unrecognized licenses: with a deny-list ( Separately, I noticed the Dependency Review check couldn't post its summary comment on fork PRs (fork |
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Summary
Turns the Dependency Review check from advisory-only into an enforced gate.
Fixes #160
.github/workflows/dependency-review.ymlpreviously had the enforcement options commented out, so a PR adding a vulnerable or copyleft-licensed dependency would only get a comment, never fail. Enabled:License denylist targets the copyleft families incompatible with this MIT project;
retry-on-snapshot-warningsavoids spurious failures when the dependency-submission snapshot lags right after a push.Validation
actionlintpasses.Note: this action requires the fork's Dependency graph to be enabled (Settings → Security & analysis). Until then the
dependency-reviewcheck fails with "Dependency graph is not enabled" — a fork setting, unrelated to this change. The other red checks (build) are the fork's missingSONAR_TOKEN/CODECOV_TOKEN.Fork PR support (added)
A plain
pull_requestrun from a fork gets a read-onlyGITHUB_TOKEN, socomment-summary-in-pr: alwayscould not post its summary on external PRs (##[warning]Unable to write summary to pull-request ...). The check still ran, but maintainers never saw the review comment on fork PRs.Fixed by switching the trigger to
pull_request_target, which runs in the base-repo context with a read/write token so the summary posts on fork PRs too. This is safe here becausedependency-review-actionnever checks out or executes PR-supplied code — it only diffs the PR's base/head via the GitHub dependency-graph/advisory API. TheCheckout repositorystep was removed (it was unused; the action needs no checkout without aconfig-file), guaranteeing no untrusted code runs with the elevated token.On unrecognized licenses (review question)
With a deny-list (
deny-licenses), a dependency whose license can't be detected is reported but does not fail the check (per the action docs: "If we can't detect the license for a dependency we will inform you, but the action won't fail."). So unrecognized licenses do not break the build here. Switching toallow-licenseswould be the opposite — it fails on anything not in the allow-list, including unknown licenses — so the deny-list is intentionally kept.deny-licensesis marked deprecated upstream; if it is ever removed, the migration is to exempt specific packages viaallow-dependencies-licenses, not to adoptallow-licenses.Maintainer TODOs
dependency-review-actionneeds it; while it is disabled the Dependency Review check fails/does nothing regardless of this PR. Once enabled,fail-on-severity: high+deny-licensestake effect on every PR.