On this page
Your application is mostly other people's code. A typical service pulls in hundreds of transitive packages, plus the GitHub Actions in its workflows, plus base container images. Supply-chain hardening on GitHub has two jobs: keep known-vulnerable versions out of the default branch, and avoid pulling in a malicious version the moment it is published.
GitHub's tools for that are the dependency graph, Dependabot alerts and updates, the dependency review action, and code scanning for your own code. This guide shows a configuration that is secure without drowning teams in pull requests.
The building blocks
- Dependency graph: parses manifests and lock files (and receives submitted snapshots from build tools) to know what each repository depends on. Everything else depends on it.
- Dependabot alerts: match the graph against the GitHub Advisory Database and open alerts for vulnerable versions.
- Dependabot security updates: open pull requests that bump a vulnerable dependency to the minimum fixed version.
- Dependabot version updates: open pull requests to keep dependencies current on a schedule, configured by
.github/dependabot.yml. - Dependency review: shows dependency changes in a pull request and, with the action, fails the check when a change introduces a vulnerable or disallowed package.
The first three can be enabled organization-wide through security configurations, as described in the organization baseline. Dependency review in private repositories requires GitHub Code Security.
A dependabot.yml that teams will accept
The fastest way to get Dependabot ignored is one pull request per package per day. Grouping and scheduling fix that:
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
cooldown:
default-days: 7
semver-major-days: 30
groups:
production-minor-patch:
dependency-type: "production"
update-types: ["minor", "patch"]
dev-dependencies:
dependency-type: "development"
labels: ["dependencies"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 7
groups:
actions:
patterns: ["*"]
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
Points worth knowing:
cooldowndelays version updates until a release has been public for the given number of days. Malicious package versions are usually detected and pulled within days, so a cooldown keeps you off the newest, least-scrutinized releases. Dependabot now applies a default cooldown of three days to version updates when none is configured; setting it explicitly documents your choice. Cooldown does not delay security updates, which is what you want.groupsbundle related updates into one pull request. Security updates can be grouped as well withapplies-to: security-updates.- The
github-actionsecosystem keeps action references current. When actions are pinned to commit SHAs, Dependabot updates the SHA and the version comment together, which is what makes SHA pinning maintainable (see the Actions security guide). - Private registries go in a top-level
registriesblock, with credentials stored as Dependabot secrets, which are separate from Actions secrets.
Treat Dependabot pull requests as untrusted
Workflows triggered by Dependabot pull requests run with a read-only GITHUB_TOKEN and receive Dependabot secrets, not Actions secrets. Keep it that way. Avoid auto-merge workflows that use pull_request_target to gain write access; that pattern has repeatedly been used to run attacker-controlled code with privileges, as explained in the pull_request_target guide.
If you do auto-merge, limit it to patch updates of development dependencies, require the normal status checks through your ruleset, and use the metadata action to decide:
name: dependabot-automerge
on: pull_request
permissions:
contents: read
jobs:
automerge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- id: meta
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
- if: steps.meta.outputs.update-type == 'version-update:semver-patch' && steps.meta.outputs.dependency-type == 'direct:development'
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Auto-merge only completes once required reviews and checks pass, so the ruleset remains the gate.
Block risky changes with dependency review
Dependabot reacts to advisories after the fact. The dependency review action stops a pull request from introducing a known-vulnerable package or a disallowed license in the first place:
name: dependency-review
on: pull_request
permissions:
contents: read
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1
with:
fail-on-severity: moderate
deny-licenses: AGPL-3.0-only, GPL-3.0-only
comment-summary-in-pr: on-failure
show-openssf-scorecard: true
Make the review job a required status check in the default branch ruleset. On organizations with many repositories, configure it once as a required workflow through an organization ruleset (Require workflows to pass before merging) instead of copying the file everywhere.
show-openssf-scorecard adds each new dependency's OpenSSF Scorecard score to the summary, a quick signal for unmaintained or poorly governed packages. More on Scorecard in the organization audit guide.
Do not forget container images and lock files
Two gaps are common even in repositories with Dependabot enabled:
- Base images referenced by tag.
FROM node:22changes under you on every rebuild. Pin images by digest (FROM node:22@sha256:...) and let thedockerecosystem in Dependabot propose digest updates, so each change is a reviewed pull request rather than a silent rebuild. - Missing or ignored lock files. Without a committed lock file, the dependency graph sees only version ranges and builds resolve whatever is newest at build time, which bypasses cooldowns and review. Commit lock files, and install with the strict commands that refuse to modify them, such as
npm ci,pnpm install --frozen-lockfileorpip install --require-hashes -r requirements.txt.
Both are also what OpenSSF Scorecard's Pinned-Dependencies check looks for.
Manage alert volume
A large organization can have thousands of open Dependabot alerts. Make them actionable:
- Auto-triage rules: GitHub's preset rules dismiss low-impact alerts for development-scoped npm dependencies. Custom rules can dismiss or snooze alerts by severity, package, scope or CVE, or open pull requests for specific conditions.
- Prioritize by exposure: EPSS scores and whether the vulnerable function is reachable matter more than CVSS alone. Alerts include EPSS data where available.
- Report by owner: query alerts per repository and route them to the owning team:
gh api --paginate "/orgs/ACME/dependabot/alerts?state=open&severity=critical,high" \
--jq '.[] | [.repository.name, .security_advisory.ghsa_id, .dependency.package.name, .security_vulnerability.severity] | @tsv' |
sort | uniq -c | sort -rn | head -20
Set a service level: critical and high alerts on production repositories fixed or explicitly accepted within a defined number of days, tracked in your normal ticketing system.
Add code scanning for your own code
Dependencies are half the picture. Code scanning with CodeQL finds injection flaws, unsafe deserialization and similar issues in the code your team writes, including in GitHub Actions workflow files, where CodeQL detects untrusted input flowing into run steps.
The simplest path is default setup: enable code scanning in the security configuration and GitHub picks the languages, the query suite and the schedule. Use advanced setup with a workflow when you need custom build steps or additional query packs:
name: codeql
on:
pull_request:
push:
branches: [main]
schedule:
- cron: "17 3 * * 1"
permissions:
contents: read
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
matrix:
language: [javascript-typescript, actions]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: ${{ matrix.language }}
queries: security-extended
- uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
Then add a Require code scanning results rule to the ruleset so that pull requests introducing high-severity alerts cannot merge.
A rollout order
- Enable dependency graph, Dependabot alerts and security updates organization-wide.
- Add
dependabot.ymlwith grouping and cooldown to repository templates, starting with thegithub-actionsecosystem. - Add dependency review as a required check on production repositories.
- Turn on code scanning default setup and the code scanning ruleset.
- Introduce auto-triage rules and an alert SLA once the backlog is visible.
References
- About Dependabot alerts (GitHub Docs)
- Dependabot options reference (GitHub Docs)
- About dependency review (GitHub Docs)
- actions/dependency-review-action (GitHub repository)
- About code scanning with CodeQL (GitHub Docs)
- GitHub Advisory Database
- FIRST Exploit Prediction Scoring System (EPSS)
- OpenSSF Concise Guide for Evaluating Open Source Software
- SLSA: Supply-chain Levels for Software Artifacts
Written by
Florian Amette, Security Engineer & EditorSecurity engineer writing practical hardening guides for GitHub organizations, repositories and CI/CD pipelines, with a focus on software supply-chain security.