Skip to content

fix(clientsetup): scope the npm token to the registry URL, docker login via stdin - #474

Merged
M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:fix/clientsetup-npm-scope-docker-stdin
Nov 13, 2026
Merged

M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:fix/clientsetup-npm-scope-docker-stdin

Conversation

@orcamedia

Copy link
Copy Markdown
Contributor

Two fixes to the generated client setup snippets (web connect panel, MCP client_setup, docs).

npm and pnpm: the token scope ignored a path prefix

With BASE_URL=https://registry.example/artifacts, the snippet was:

npm config set registry https://registry.example/artifacts/repos/team/
npm config set //registry.example/repos/team/:_authToken <TOKEN>

npm sends a token only to URLs under the scope it's stored for, so private installs and publishes went out unauthenticated. The scope is now the registry URL without its scheme: //registry.example/artifacts/repos/team/:_authToken. Servers at the origin root get the same line as before. Yarn wasn't affected, because it uses npmAuthToken.

  • New placeholder: {{basePath}}, the base URL without its scheme. valuesFor fills it in Go and installCommands.ts fills it in the web renderer. clientsetup.generated.ts is regenerated.
  • Tests:
    • TestNPMCredentialScopeFollowsTheRegistryURL covers a root origin, a one-segment prefix, and a prefix with a port.
    • A matching web test.

docker: --password-stdin instead of -p

echo "<TOKEN>" | docker login HOST -u <USERNAME> --password-stdin

-p puts the token in the process arguments, and docker prints a warning for it. The snippet keeps the <TOKEN> placeholder convention the snippet tests enforce. docs/formats/docker.md is updated to match.

Not changed: NuGet --store-password-in-clear-text

A review flagged this flag. I left it, because per Microsoft's docs encrypted credentials only work on Windows, so on Linux and macOS (most CI) the command needs it. If you'd like, I can add a second NuGet variant that keeps the token out of NuGet.Config (an environment-variable credential), or a one-line note in docs/formats/nuget.md. Tell me which you prefer.

Checks

  • golangci-lint run ./... passes.
  • go test passes for internal/{clientsetup,mcp,api,repotype} and cmd/....
  • make generate shows no drift, and make docs-check passes.
  • vue-tsc --noEmit passes. The web unit tests are updated; I couldn't run them locally (no bun here), so CI's web job is their first run.

🤖 Generated with Claude Code

…in via stdin

The npm and pnpm snippets set the registry to the full base URL but
scoped the token to //HOST/repos/NAME/ only. With the server published
under a path prefix (https://host/artifacts), npm matches credentials by
URL prefix and never sent the token. The scope is now the base URL
without its scheme, through a new {{basePath}} placeholder that the Go
renderer and web/src/lib/installCommands.ts both fill.

The docker snippet passes the token with --password-stdin instead of -p,
which docker itself warns about (process arguments).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@orcamedia
orcamedia force-pushed the fix/clientsetup-npm-scope-docker-stdin branch from 88df385 to 7476356 Compare November 12, 2026 18:55
# Conflicts:
#	docs/getting-started/upgrading.md
@M0Rf30
M0Rf30 merged commit da6dcb7 into openartifact:main Nov 13, 2026
19 checks passed
@orcamedia
orcamedia deleted the fix/clientsetup-npm-scope-docker-stdin branch November 13, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants