Dependabot can now access private packages hosted in GitHub Packages without requiring a personal access token.
This is a useful change for teams that previously had to create a personal access token, store it as a Dependabot secret, and maintain that credential just so Dependabot could read an internal package.
The newer approach uses Dependabot's GITHUB_TOKEN and the package's existing repository access rules.
There is one important requirement: the repository running Dependabot must be explicitly granted access to the private package through the package's Manage Actions access settings.
Once that access is configured, Dependabot can authenticate to supported GitHub-hosted registries without a PAT-based registry entry in dependabot.yml.
The Old Approach
Before automatic access to GitHub-hosted registries, a common setup looked like this:
version: 2
registries:
github-packages:
type: nuget-feed
url: https://nuget.pkg.github.com/my-company/index.json
token: ${{secrets.GITHUB_PACKAGES_TOKEN}}
updates:
- package-ecosystem: nuget
directory: "/"
registries:
- github-packages
schedule:
interval: weekly
The token stored in the Dependabot secret was typically a personal access token with permission to read packages.
That worked, but it introduced another credential that an organization had to manage.
The token could expire, be revoked, lose the required permission, or remain in the system after the person who created it left the organization.
For a dependency bot that only needs read access to a package, maintaining a personal credential is unnecessary overhead.
The New Approach
Dependabot can now request packages: read using its own GITHUB_TOKEN.
The package grants access to the repository, and Dependabot uses that grant when it pulls the package.
The resulting model is simpler:
Private GitHub Package
|
v
Manage Actions access
|
+---- Repository A: Read
+---- Repository B: Read
|
v
Dependabot
|
v
GITHUB_TOKEN
|
v
packages: read
The important point is that authentication and authorization are still separate concepts.
The token provides the identity and authentication mechanism. The package's access configuration determines whether that repository is allowed to read the package.
Configure Package Access First
The most important configuration step happens in the package settings, not in dependabot.yml.
For every private package that Dependabot needs to read:
Open the package settings.
Find Manage Actions access.
Add the repository where Dependabot runs.
Give that repository Read access.
Repeat the process for each private package.
Dependabot only needs read access when it is checking package versions.
You do not need to grant write or administrative package permissions simply because Dependabot creates pull requests.
Example with a Private NuGet Package
Suppose an organization publishes:
Company.Security.Core
Company.Data.Client
Company.Logging
to GitHub Packages.
An application repository contains:
<ItemGroup>
<PackageReference
Include="Company.Security.Core"
Version="4.2.0" />
<PackageReference
Include="Company.Data.Client"
Version="7.1.0" />
</ItemGroup>
The package repositories must grant the application repository read access through Manage Actions access.
After that, Dependabot can access the packages using its GitHub-provided token.
The important part is that the dependabot.yml file does not need a PAT-based registry entry for these GitHub-hosted packages.
A minimal configuration can therefore remain focused on dependency updates:
version: 2
updates:
- package-ecosystem: nuget
directory: "/"
schedule:
interval: weekly
The package access is handled through GitHub's package permissions.
What Happens to an Existing PAT Configuration?
If you already have a PAT-based configuration, you do not necessarily need to keep it.
For a package that qualifies for automatic GitHub-hosted registry access, you can remove the PAT-based registry configuration after verifying that repository access has been granted.
For example, this:
registries:
github-packages:
type: nuget-feed
url: https://nuget.pkg.github.com/my-company/index.json
token: ${{secrets.GITHUB_PACKAGES_TOKEN}}
updates:
- package-ecosystem: nuget
directory: "/"
registries:
- github-packages
schedule:
interval: weekly
can become:
version: 2
updates:
- package-ecosystem: nuget
directory: "/"
schedule:
interval: weekly
Do not delete the secret first and assume everything will continue working.
First grant package access, run a Dependabot update, verify that the private package can be resolved, and then remove the obsolete credential configuration.
Why This Is Better Than a Personal Access Token
The biggest improvement is credential lifecycle management.
With a PAT-based configuration:
Developer creates PAT
|
v
PAT stored as Dependabot secret
|
v
Dependabot uses PAT
|
+---- Token expires
+---- Token revoked
+---- User leaves organization
+---- Permission changes
With automatic GitHub-hosted registry access:
Repository
|
v
Package access grant
|
v
Dependabot GITHUB_TOKEN
|
v
Read package
The package access relationship is tied to the repository instead of an individual developer's credential.
That makes the configuration easier to audit and maintain.
Repository Access Is Still Required
Removing the PAT does not mean private packages become publicly available to Dependabot.
The repository must still have permission to access the package.
For example:
Company.Security.Core
|
+-- Application-A: Read
+-- Application-B: Read
+-- Application-C: No access
If Application-C uses Company.Security.Core but has not been granted access, Dependabot cannot simply bypass that restriction.
This is an important security boundary.
GitHub Actions Access and Dependabot
The new mechanism follows the same general package-access model used by GitHub Actions.
Dependabot jobs can request the package read permission through their GITHUB_TOKEN.
This is particularly useful because Dependabot now runs its jobs using GitHub Actions infrastructure.
The package itself decides which repositories are allowed to use it.
That means an organization can maintain a clear relationship:
Package
|
+-- Repository that publishes it
|
+-- Repository that consumes it
|
+-- Repository used for testing
Each repository can be given only the access it requires.
What About GitHub Container Registry?
The same automatic access mechanism also applies to GitHub-hosted container registries supported by Dependabot.
For example, a repository may depend on an internal container image.
The same principle applies:
Private container image
|
v
Manage Actions access
|
v
Repository gets Read access
|
v
Dependabot uses GITHUB_TOKEN
This avoids creating a separate long-lived personal credential for the package pull.
Join the conversation! Your thoughts help the community grow.