CCyberwiki

Dependabot

Dependabot
TypeDependency monitoring and update service
Made byGitHub
PartsAlerts, security updates, version updates
Configuration.github/dependabot.yml and the repository settings
OWASP Top 10A03:2025
RelatedSoftware composition analysis

Dependabot reads the package manifests and lockfiles of a GitHub repository and matches the versions they name against the GitHub Advisory Database. A match becomes a warning on the repository and, if the owner allows it, a pull request that raises the package to a fixed release. Dependabot can also propose upgrades for packages that are only out of date. It is software composition analysis run by the code host itself, aimed at Vulnerable dependencies.

The name covers three features that are switched on separately: alerts, security updates and version updates. Alerts only report. Security updates open a pull request when an alert fires; version updates open them on a schedule, whether or not any advisory exists.

Alerts

Dependabot checks the repository's default branch at two moments: when GitHub adds a new entry to its advisory database, and when a commit changes the dependency graph, for example by adding a package or changing a version.1 A match appears on the repository's security tab with a link to the affected manifest file, the severity, and a fixed version where one exists.

Only advisories that GitHub has reviewed raise an alert, a newly disclosed flaw can take time to arrive, and archived repositories are not scanned at all.1 For GitHub Actions used in workflows, an alert fires only when the action is referenced by a version number; an action pinned to a commit SHA gets none.1 This cuts against pinning actions to a SHA; for a pinned action, version updates (below) are what move the reference forward.2

Turning alerts on for an old project does not send an email for each existing problem. Notifications cover only vulnerabilities found after the switch, so the existing backlog has to be read on the alerts page.1

Security updates

With security updates on, each new alert starts an attempt at a fix. Dependabot checks whether the vulnerable package can be raised to a fixed version without breaking the rest of the dependency graph, then opens a pull request to the lowest version that "includes the patch", linked to the alert. If no such upgrade works, it records an error on the alert instead.3 Merging the pull request closes the alert.

Alerts cover the whole graph, including packages pulled in indirectly by other packages. Security updates act only on dependencies named in a manifest or lockfile. In npm projects Dependabot can reach a vulnerable indirect package by updating the parent that requires it; with most other package managers it gives up when the fix would need the parent upgraded.3 No more than 10 security pull requests stay open at once, a fixed cap separate from the one for version updates.4

Both switches live in the repository under Settings, Advanced Security, next to Dependabot alerts and Dependabot security updates.56

Version updates

Version updates have nothing to do with advisories. They start when a file named dependabot.yml is committed to the .github folder, listing each package manager, the folder its manifest is in, and a schedule.2 On each run Dependabot compares the declared versions with the newest releases, reading version numbers as semantic versions, and opens a pull request that raises an outdated dependency to its latest version, with the changelog and release notes in its description.

# .github/dependabot.yml
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    cooldown:
      default-days: 5
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"

The cooldown key sets how many days a new release must be public before it is proposed. Without it Dependabot waits 3 days; the example raises that to 5. Security updates skip the wait.24 GitHub's stated reason is to let a release stabilize. The wait also means a fresh release, including a malicious one pushed after a Software supply chain compromise, reaches the repository no sooner than that number of days after publication. Five version-update pull requests may be open at a time unless open-pull-requests-limit says otherwise, and the ignore and allow rules with update-types filter version updates only, never security updates.4

Pull requests in CI

A Dependabot pull request runs the repository's CI like any other, so the tests show whether the upgrade breaks anything before it is merged. GitHub treats workflow runs started by Dependabot on push and pull_request events as if they came from a fork: the GITHUB_TOKEN is read-only and repository secrets are withheld.7 The only secrets passed in are those stored separately as Dependabot secrets. The pull_request_target event does not have these limits; Pwn request and Secret exposure in CI/CD workflows explain what goes wrong when untrusted pull request code runs with them lifted.

GitHub's example for auto-merging patch releases runs the job only when the pull request author is dependabot[bot], reads the update type from the dependabot/fetch-metadata action, and pairs this with the Branch protection and rulesets rule that required status checks must pass before merging.8

Impersonation

Between 8 and 11 July 2023, an attacker pushed commits titled "fix" to hundreds of public and private repositories under an author name made to read dependabot[bot].9 The commits came from victims' own accounts, opened with stolen personal access tokens. Each added a workflow, hook.yml, that ran on every push and posted the project's secrets and variables to an outside server, and edited existing JavaScript files to capture passwords typed into web forms.910 Checkmarx, which found the campaign, could not say how the tokens were stolen. Its explanation for the disguise was that "many developers do not check the actual changes" in a Dependabot commit.9

Dependabot signs its own commits by default.3 The 2023 commits borrowed only its name, which the attackers wrote into the commit details themselves.9

Pausing

Dependabot stops itself in repositories where nobody responds. If one of its pull requests has been open for more than 90 days and no person has merged or closed a Dependabot pull request, edited dependabot.yml, turned on security updates or used an @dependabot command in that time, it stops opening pull requests for both version and security updates. A banner appears on the open pull requests and in the settings, and the pause ends as soon as someone acts on one of them.11

In SecFlash

On the Cloud page, SecFlash reports a connected repository with Dependabot alerts turned off as SF-CLD-602, and one where security updates are off or paused as SF-CLD-603.

See also

References

  1. a b c d GitHub. "Dependabot alerts". GitHub Docs.
  2. a b c GitHub. "Dependabot version updates". GitHub Docs.
  3. a b c GitHub. "Dependabot security updates". GitHub Docs.
  4. a b c GitHub. "Dependabot options reference". GitHub Docs.
  5. back GitHub. "Configuring Dependabot alerts". GitHub Docs.
  6. back GitHub. "Configuring Dependabot security updates". GitHub Docs.
  7. back GitHub. "Troubleshooting Dependabot on GitHub Actions". GitHub Docs.
  8. back GitHub. "Automating Dependabot with GitHub Actions". GitHub Docs.
  9. a b c d Checkmarx (2023). "Surprise: When Dependabot Contributes Malicious Code". Checkmarx blog.
  10. back Toulas, B. (27 September 2023). "GitHub repos bombarded by info-stealing commits masked as Dependabot". BleepingComputer.
  11. back GitHub. "Dependabot updates stopped". GitHub Docs.