Skip to content

Commit ea3740d

Browse files
authored
docs(libraries): document update-hashes authentication flow
Add an Authentication subsection to the JavaScript and Python build configuration guides covering how `chainctl libraries update-hashes` authenticates to Chainguard Libraries: logged-in session (and `chainctl auth login --audience=libraries.cgr.dev` / `configure-npm` for no prompt), `--parent` / pull-token, `--token` / `CHAINCTL_AUTH_TOKEN` for CI, `~/.netrc` (and `--ignore-netrc`), and credentials for `--registry-url` repository managers. Point the quickstart migration note at these sections via stable anchors. Missing docs were reported at https://linear.app/chainguard/issue/ECO-2157/prospect-cyberhaven-chainctl-libraries-update-hashes-hides-bad-netrc
1 parent 204c9c8 commit ea3740d

3 files changed

Lines changed: 68 additions & 1 deletion

File tree

content/chainguard/libraries/javascript/build-configuration.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,38 @@ manager will accept packages from Chainguard.
7878

7979
Learn more in the [JavaScript migration guide](/chainguard/libraries/javascript/migration/#step-3-update-your-lockfile) and in the [`chainctl libraries update-hashes` command docs](/chainguard/chainctl/chainctl-docs/chainctl_libraries_update-hashes/).
8080

81+
<a id="update-hashes-auth"></a>
82+
83+
### Authentication
84+
85+
`update-hashes` fetches checksums from Chainguard Libraries (`libraries.cgr.dev`),
86+
which requires authentication. Choose whichever fits your environment:
87+
88+
- **Logged in locally**: Run the command while authenticated; if you have no
89+
other credential it prompts for an organization and authenticates with a
90+
[pull token](/chainguard/libraries/access/#pull-token). Pass
91+
`--parent <organization>` to skip the prompt. To avoid the prompt entirely,
92+
scope your login to the libraries registry once with
93+
`chainctl auth login --audience=libraries.cgr.dev` — that session is then used
94+
automatically. (`chainctl auth configure-npm` also sets up this
95+
libraries-scoped session as part of configuring npm.)
96+
- **CI or non-interactive**:
97+
- For a session token, pass `--token <token>` or set `CHAINCTL_AUTH_TOKEN`. The
98+
token must be scoped to the libraries registry; mint one with
99+
`chainctl auth token --audience=libraries.cgr.dev`.
100+
- For a [pull token](/chainguard/libraries/access/#pull-token) (an identity and
101+
secret), pass it as basic auth: `--username <identity> --password <secret>`,
102+
or set `CHAINCTL_REGISTRY_USERNAME` / `CHAINCTL_REGISTRY_PASSWORD`.
103+
- **From `~/.netrc`**: Credentials for the registry host are read from `~/.netrc`
104+
(or `$NETRC`); see [.netrc for authentication](/chainguard/libraries/access/#netrc).
105+
Pass `--ignore-netrc` to skip an unrelated entry.
106+
107+
When you target a repository manager with `--registry-url` (for example
108+
Artifactory or JFrog), authenticate with **that** registry's credentials —
109+
`--username`/`--password`, the `CHAINCTL_REGISTRY_USERNAME` /
110+
`CHAINCTL_REGISTRY_PASSWORD` environment variables, or a matching `~/.netrc`
111+
entry. Chainguard-scoped tokens are never sent to third-party hosts.
112+
81113

82114
<a id="npm"></a>
83115

content/chainguard/libraries/python/build-configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,37 @@ When using a repo manager, pass the full repository URL with `--registry-url`.
165165
Learn about using this command with repo managers in the [Global
166166
configuration](/chainguard/libraries/python/global-configuration/) page.
167167

168+
<a id="update-hashes-auth"></a>
169+
170+
#### Authentication
171+
172+
`update-hashes` fetches checksums from Chainguard Libraries (`libraries.cgr.dev`),
173+
which requires authentication. Choose whichever fits your environment:
174+
175+
- **Logged in locally**: Run the command while authenticated; if you have no
176+
other credential it prompts for an organization and authenticates with a
177+
[pull token](/chainguard/libraries/access/#pull-token). Pass
178+
`--parent <organization>` to skip the prompt. To avoid the prompt entirely,
179+
scope your login to the libraries registry once with
180+
`chainctl auth login --audience=libraries.cgr.dev` — that session is then used
181+
automatically.
182+
- **CI or non-interactive**:
183+
- For a session token, pass `--token <token>` or set `CHAINCTL_AUTH_TOKEN`. The
184+
token must be scoped to the libraries registry; mint one with
185+
`chainctl auth token --audience=libraries.cgr.dev`.
186+
- For a [pull token](/chainguard/libraries/access/#pull-token) (an identity and
187+
secret), pass it as basic auth: `--username <identity> --password <secret>`,
188+
or set `CHAINCTL_REGISTRY_USERNAME` / `CHAINCTL_REGISTRY_PASSWORD`.
189+
- **From `~/.netrc`**: Credentials for the registry host are read from `~/.netrc`
190+
(or `$NETRC`); see [.netrc for authentication](/chainguard/libraries/access/#netrc).
191+
Pass `--ignore-netrc` to skip an unrelated entry.
192+
193+
When you target a repository manager with `--registry-url` (for example
194+
Artifactory or JFrog), authenticate with **that** registry's credentials —
195+
`--username`/`--password`, the `CHAINCTL_REGISTRY_USERNAME` /
196+
`CHAINCTL_REGISTRY_PASSWORD` environment variables, or a matching `~/.netrc`
197+
entry. Chainguard-scoped tokens are never sent to third-party hosts.
198+
168199
By default, Chainguard hashes are appended alongside existing upstream hashes. After updating the lockfiles, to switch your environment to use Chainguard packages, configure your tool to use the Chainguard index and reinstall. The command will output
169200
a "Next steps" section that includes the tool-specific command for reinstalling.
170201

content/chainguard/libraries/quickstart.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ and
210210
> **Migrating an existing Python or JavaScript project?** If you have an
211211
> existing lockfile with upstream hashes, use `chainctl libraries update-hashes`
212212
> to update checksums to Chainguard's automatically, without regenerating your
213-
> lockfile from scratch.
213+
> lockfile from scratch. The command authenticates to Chainguard Libraries; see
214+
> the authentication options in the
215+
> [Python](/chainguard/libraries/python/build-configuration/#update-hashes-auth) and
216+
> [JavaScript](/chainguard/libraries/javascript/build-configuration/#update-hashes-auth)
217+
> build configuration guides.
214218
215219
## Step 4: Verify your libraries
216220

0 commit comments

Comments
 (0)