Vulnerability scanners and Chainguard Libraries
Details for using vulnerability scanners with Chainguard Libraries.
For the complete documentation index, see llms.txt.
Chainguard Libraries provide controlled access to security-enhanced Java and Python dependencies through the unified Chainguard platform authentication system. This guide explains how to access (download) Chainguard library artifacts for your organization.
chainctl commands with the
--parent parameter.There are two approaches to access: Using an artifact manager or direct access.
If your organization uses an artifact manager such as Cloudsmith, JFrog Artifactory, or Sonatype Nexus, you can set up and configure credentials once per language ecosystem. Then, all projects and developers automatically inherit the configuration. This option suits organizations with multiple teams, and provides centralized access controls and consistent uptime.
Set up authentication directly in each project’s build configuration. This option allows for faster initial setup, but it does not allow for global configuration. It requires configuration per project and workstation, which creates more overhead as you scale across teams and projects.
An artifact manager authenticates to Chainguard Libraries with a pull token. For direct access, you can use a session token or a pull token.
Chainguard Libraries supports both short-lived credentials and long-lived pull tokens. Chainguard recommends short-lived credentials where your tools and workflows support them, because they expire on their own and are tied to a person or workload. Pull tokens work with every build tool and artifact manager.
| Option | How it works | Lifetime | Good fit |
|---|---|---|---|
Session token with a chainctl helper (recommended) | Chainguard provides authentication helpers that retrieve a token using chainctl. Helpers are available for Python (Python keyring provider), JavaScript (chainctl auth configure-npm), and .NET (chainctl auth configure nuget). | Up to one hour | Workstations with direct access, with the use of a chainctl helper |
Session token from chainctl auth token | You supply the token to your build tool as a password, and get a new one when it expires. | Up to one hour | Scripts and short sessions with build tools that have no helper |
| Assumable identity (recommended for CI/CD) | Your CI/CD platform exchanges its OIDC token for a Chainguard token. See assumable identities. | Up to one hour | CI/CD platforms that support OIDC, such as GitHub Actions |
| Pull token | A username and password for an identity that can only pull. Store it in a secrets manager or password manager and load it from environment variables. | The TTL you set, 30 days by default and up to 365 days | Any build tool, artifact managers, CI/CD platforms without OIDC, and teams that share one credential |
For guidance that applies to every option, see Credential guidelines.
A check in Chainguard Checks doesn’t need a pull token. It can download JavaScript and Python libraries through a workload identity that holds the libraries.javascript.pull or libraries.python.pull role. A Chainguard Workspaces session has no credential for Chainguard Libraries, as described in Credentials a session can’t supply.
Once your user account is created and access is confirmed, install the
Chainguard Control chainctl command line
tool and log in to your
account:
chainctl auth loginNote:
chainctl auth loginsupports several login flows, including device-code login for machines without a browser and assumable identities for CI. If the default browser flow doesn't work in your environment, see Authentication options.
After authentication in a browser window, a successful login displays a message and a token:
Successfully exchanged token.
Valid! Id: 8a4141a........7d9904d98cChainguard Libraries accepts two kinds of credentials:
chainctl login, scoped to
libraries.cgr.dev. It’s valid for up to one hour, pulls are associated with
your user, and you can end the session with chainctl auth sessions revoke.
Getting one needs no permissions beyond pull access, and every machine that
uses it needs chainctl.chainctl, but it stays valid until its TTL ends or you delete
it. Creating one requires a pull_token_creator role. For details, see
Creating pull tokens for libraries.Build tools get session tokens from chainctl in the following ways:
The Python keyring provider runs chainctl auth token --audience=libraries.cgr.dev each time pip or uv needs credentials, so no
token is written to your configuration files.
chainctl auth configure-npm
writes your session token to the project .npmrc. Re-run the command when
the token expires.
chainctl auth configure nuget writes your session
token to the NuGet configuration file. Re-run the command when the token
expires.
Other build tools, such as Maven, Gradle, and Go, accept a session token in
place of a pull token. Use _token as the username and the output of
chainctl auth token as the
password. For example, set the environment variables that the Java build
configuration uses:
export CHAINGUARD_JAVA_IDENTITY_ID=_token
export CHAINGUARD_JAVA_TOKEN="$(chainctl auth token --audience=libraries.cgr.dev)"Run the commands again when the token expires.
To reduce how often you need to log in again on a workstation, install the token refresh service:
chainctl auth configure-refresh-service install --audience=libraries.cgr.devThe refresh service renews the libraries.cgr.dev token in the chainctl
token cache, which the Python keyring provider and chainctl auth token read.
It only renews a token that’s already in the cache, so log in with chainctl auth login --audience=libraries.cgr.dev first. It doesn’t update a token that
was already copied into a file or an environment variable, such as .npmrc,
the NuGet configuration file, or CHAINGUARD_JAVA_TOKEN.
Follow these guidelines for whichever option you choose:
_auth and _authToken entries in .npmrc,
out of version control.Pull tokens authenticate requests to download library artifacts from Chainguard. You can create the pull tokens:
For environments where short-lived credentials are not suitable, such as some CI/CD platforms, you can generate a pull token, which provides longer-lived access to Chainguard Libraries.
To create a pull token you must have the relevant entitlement
for the ecosystem and the libraries.java.pull_token_creator,
libraries.javascript.pull_token_creator, or
libraries.python.pull_token_creator role.
Create a new pull token for the Chainguard Libraries for Java with the chainctl auth pull-token command:
chainctl auth pull-token --repository=java --ttl=8670h--repository=java: retrieve the token for use with Chainguard Libraries for
Java. Use python for a token to use
Chainguard Libraries for Python and
javascript for a token to use Chainguard Libraries for
JavaScript.--ttl=8670h: set the duration for the validity of the token, defaults to
720h (equivalent to 30 days), maximum valid value is 8760h (equivalent to
365 days), valid unit strings range from nanoseconds to hours and are ns,
us, ms, s, m, and h.Use the optional --name flag to supply a meaningful and short name for the
token, to be able to locate it easier at a later stage.
If you belong to a single organization, chainctl selects it automatically. If
you have access to more than one, it asks “With which location is the pull token
associated?” Use the arrow keys to select the organization that has the
entitlement to access Chainguard Libraries for Java, and press / to filter the
list. Pass --parent=<organization> to skip the prompt.
chainctl returns a username and password suitable for basic authentication in
the response:
Username: <identity-id>
Password: <pull-token>Follow these steps to create a pull token for Chainguard Libraries in the Chainguard console:
The username is the identity ID of the pull token identity that chainctl just
created, and the password is the token itself. chainctl labels the same two
values identity_id and token with --output=json, and
CHAINGUARD_JAVA_IDENTITY_ID and CHAINGUARD_JAVA_TOKEN with --output=env.
Refer to pull token output formats and credential
names for the full mapping.
The returned username and password combination is a new credential set in the organization that is independent of the account used to create and retrieve the credential set. It is therefore suitable for use in any service application, such as a repository manager or a build tool that is not tied to a specific user. For individual development with direct access, prefer a session token where your build tool supports it.
To use the pull token in another environment, supply the username and password for basic authentication. Note that the actual returned values are much longer.
Note: Chainguard does not offer an SLA for uptime availability of the Chainguard Libraries repositories at
libraries.cgr.dev. To reduce production risk and ensure reliability, we recommend proxying the repositories through your own artifact repository whenever possible.
For artifact manager setup, see the global configuration guides:
For direct access, see the build configuration guides:
Using environment variables for username and password is more secure than hard coding the values in configuration files. In addition, you can use the same configuration and files for all users to simplify setup and reduce errors.
Use the env environment output option to create a snippet for a new token
suitable for integration in a script.
$ chainctl auth pull-token --output env --repository=java
export CHAINGUARD_JAVA_IDENTITY_ID=<identity-id>
export CHAINGUARD_JAVA_TOKEN=<pull-token>Combine the call with eval to populate the environment variables directly by
calling chainctl:
eval $(chainctl auth pull-token --output env --repository=java)Equivalent commands for Python and JavaScript are supported and result in values
for the CHAINGUARD_PYTHON_IDENTITY_ID/CHAINGUARD_PYTHON_TOKEN and
CHAINGUARD_JAVASCRIPT_IDENTITY_ID/CHAINGUARD_JAVASCRIPT_TOKEN variables.
Use the export commands in a ~/.env or similar file or use your preferred
secrets management application to reuse the token in multiple sessions. Source
the file or load the secrets from the app to have access to the tokens in your
shell session, including build configurations file that can load from
environment variables, for example a Maven settings.xml file.
Running this command as part of a login script or some other automation allows your organization to replace actual username and password values in your build tool configuration with environment variable placeholders:
When using uv for Python, you can supply credentials through index-scoped
environment variables instead of a shared secrets file or .netrc. For a named
index, uv reads UV_INDEX_<NAME>_USERNAME and UV_INDEX_<NAME>_PASSWORD, where
<NAME> is the index name uppercased with hyphens replaced by underscores.
For an index named chainguard, set:
export UV_INDEX_CHAINGUARD_USERNAME="${CHAINGUARD_PYTHON_IDENTITY_ID}"
export UV_INDEX_CHAINGUARD_PASSWORD="${CHAINGUARD_PYTHON_TOKEN}"This pairs well with the eval approach above: generate the
CHAINGUARD_PYTHON_IDENTITY_ID and CHAINGUARD_PYTHON_TOKEN variables, then
map them to uv’s index-scoped names. Refer to the uv build
configuration for index
setup details.
curl and a number of other tools support configuration of
username and password authentication details for a specific domain in the
.netrc
file,
typically located in the user’s home directory.
Use this approach for authentication to a repository manager in your organization or to Chainguard Libraries directly, for example with pip and others for Chainguard Libraries for Python, with bazel for Chainguard Libraries for Java or for manual testing with curl.
The following example shows a suitable setup for a repo manager available at
repo.example.com:
machine repo.example.com
login YOUR_USERNAME_FOR_REPOSITORY_MANAGER
password YOUR_PASSWORDFor a direct connection to Chainguard Libraries, for example for testing with
curl, use the following example with the username
CHAINGUARD_PYTHON_IDENTITY_ID and password CHAINGUARD_PYTHON_TOKEN value for
the pull token for the desired language ecosystem:
machine libraries.cgr.dev
login CHAINGUARD_PYTHON_IDENTITY_ID
password CHAINGUARD_PYTHON_TOKENNote that the long string for the password value must use only one line.
When you use this .netrc file in a container build, mount it as a build secret rather than copying it into an image layer. See Container builds.
Use the credentials for manual testing in a browser or with a script and curl if you know the URL for a specific library artifact. Refer to the following sections for more details:
Python users can leverage an alternative to pull tokens. The Chainguard keyring
implementation
provides short-lived credentials from supported environments, such as local
development and CI/CD platforms that can use assumable
identities. For GitHub
Actions, follow
Create an assumable identity for a GitHub Actions workflow
and bind the libraries.python.pull role.
Where possible, Chainguard recommends using short-lived credentials to access Chainguard Libraries.
To set up the keyring, install the keyrings-chainguard-libraries package:
pip install keyrings-chainguard-librariesNote: If you haven’t set up access to Chainguard Libraries for Python, the above command installs the package from PyPI. After installing and configuring Chainguard Libraries for Python, you can get the private package again, to get the package built by Chainguard. To re-install the package:
pip install keyrings-chainguard-libraries --ignore-installed --no-cache-dirOnce the keyring package is installed, when you request to install packages from
Chainguard Libraries for Python, the keyring automatically retrieves short-lived
credentials for you, using chainctl. The keyring requires chainctl to be
installed and logged in on the same machine. It holds the token in memory only,
and it works only for requests that go directly to libraries.cgr.dev, not
through an artifact manager. To reduce how often you need to log in again, pair
it with the token refresh service.
To use the keyring with a project uv, install the keyring:
uv pip install keyrings-chainguard-librariesNote: If you haven’t set up access to Chainguard Libraries for Python, the above command installs the package from PyPI. After installing and configuring Chainguard Libraries for Python, you can get the private package again, to get the package built by Chainguard. To re-install the package:
uv pip install keyrings-chainguard-libraries --reinstall --no-cacheBy default, uv disables keyring auth.
To enable it in the global uv.toml:
keyring-provider = "subprocess"To enable it in a project-specific pyproject.toml:
[tool.uv]
keyring-provider = "subprocess"Pull tokens are separate identities with username and password that are used for access to Chainguard Libraries. The tokens have a limited Time to Live (TTL) with a default of 30 days and a maximum TTL of 365 days.
As a result, pull tokens become invalid after the TTL and are flagged as expired. For your use of Chainguard Libraries you must replace the token with a new one.
Expired tokens can no longer be used for access to Chainguard Libraries, but otherwise do not cause any issues and continue to exist until you delete them.
Inspect all pull tokens for your organization in the Chainguard console:
The list includes the following columns:
Use the action to remove a pull token:
Alternatively use chainctl with the auth pull-token and iam identities commands for various inspection and management tasks.
List all pull tokens with the list command:
chainctl auth pull-token listThe displayed list includes the following columns:
apk.pull, container
images registry.pull, Python libraries libraries.python.pull, Java
libraries libraries.java.pull, and JavaScript libraries
libraries.javascript.pull .List all pull tokens for Chainguard Libraries for Java that are not yet expired:
chainctl auth pull-token list --repository=javaList all expired pull tokens for Chainguard Libraries for Python:
chainctl auth pull-token list --repository=python --expired=trueUse the delete command for IAM
identities
to delete a specific pull token using its ID 45a0c61ea6fd97...:
chainctl iam identities delete 45a0c61ea6fd97...Use the --expired flag with the identifier or name of your organization,
example in this sample, to remove all expired static identities, including
expired pull tokens:
chainctl iam ids rm --expired --parent=exampleAn entitlement grants your organization access to a Chainguard Libraries ecosystem. To add or remove an entitlement, contact your Chainguard account team.
Once your organization is entitled to an ecosystem, you can list your
entitlements and change their upstream fallback policy yourself with chainctl libraries entitlements.
New entitlements have upstream
fallback
on by default. To turn on upstream fallback for an entitlement that has it off,
use the --policy flag:
chainctl libraries entitlements create --ecosystems=JAVASCRIPT --policy=CHAINGUARD_AND_UPSTREAMTo change the upstream fallback policy on an existing entitlement, rerun the
command with the new --policy value. For example, --policy=CHAINGUARD serves
only Chainguard-built packages.
You can verify entitlements for your organization example.com to verify which ecosystems are enabled:
chainctl libraries entitlements listThe output includes the ecosystem and configured policy in the table:
Ecosystem Library Entitlements for example (45a0...p7q)
ID | ECOSYSTEM | POLICY
-----------------------------------------------------------|------------|--------------------------------
45a0c61a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q/12345abc67890 | JAVASCRIPT | POLICY_CHAINGUARD_AND_UPSTREAM
45a0c61a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q/45678abc67890 | JAVA | POLICY_CHAINGUARD
45a0c61a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q/56789abc67890 | PYTHON | POLICY_CHAINGUARDUsers with the Owner role can create, enable, disable, and list library policies using chainctl libraries policy commands. These policies apply to all packages pulled through Chainguard Repository. The upstream fallback must be enabled for an ecosystem in order to use policies.
Learn about how to manage policies in the Libraries policies page.
Last updated: 2026-11-12 20:31