Skip to content

fix(publish): authenticate the package existence check so private packages work - #36656

Merged
crowlKats merged 3 commits into
denoland:mainfrom
crowlKats:jsr-private-packages-publish
Aug 26, 2026
Merged

fix(publish): authenticate the package existence check so private packages work#36656
crowlKats merged 3 commits into
denoland:mainfrom
crowlKats:jsr-private-packages-publish

Conversation

@crowlKats

Copy link
Copy Markdown
Member

The registry responds with a 404 for a private package unless the request is authenticated as someone with access to it (jsr-io/jsr#1270). deno publish checked whether packages exist before obtaining auth headers and without sending any authorization, so publishing to an existing private package misreported it as missing: the CLI directed the user to the package creation page and then polled the (still unauthenticated) package endpoint forever.

This obtains the auth headers first, and sends the per-package authorization on the existence check and on the creation poll loop. For public packages nothing changes except the order of the auth prompt relative to the missing-package prompt.

The early already-published version probe (check_version_exists) intentionally stays unauthenticated: it fails open, and a private package's already-published version is caught by the existing duplicateVersionPublish handling during the publish itself.

Required for jsr-io/jsr#1270 (private packages).

…kages work

The registry responds with a 404 for a private package unless the request
is authenticated as someone with access to it. `deno publish` checked
whether packages exist before obtaining auth headers and without sending
any authorization, so publishing to an existing private package misreported
it as missing: the CLI directed the user to the package creation page and
then polled the (still unauthenticated) package endpoint forever.

Obtain the auth headers first, and send the per-package authorization on
the existence check and on the creation poll loop.
…s-publish

# Conflicts:
#	cli/registry.rs
#	cli/tools/publish/mod.rs
@crowlKats
crowlKats enabled auto-merge (squash) August 25, 2026 22:44
@crowlKats
crowlKats merged commit 1100198 into denoland:main Aug 26, 2026
136 checks passed
bartlomieju pushed a commit that referenced this pull request Aug 27, 2026
…kages work (#36656)

The registry responds with a 404 for a private package unless the
request is authenticated as someone with access to it (jsr-io/jsr#1270).
`deno publish` checked whether packages exist before obtaining auth
headers and without sending any authorization, so publishing to an
existing private package misreported it as missing: the CLI directed the
user to the package creation page and then polled the (still
unauthenticated) package endpoint forever.

This obtains the auth headers first, and sends the per-package
authorization on the existence check and on the creation poll loop. For
public packages nothing changes except the order of the auth prompt
relative to the missing-package prompt.

The early already-published version probe (`check_version_exists`)
intentionally stays unauthenticated: it fails open, and a private
package's already-published version is caught by the existing
`duplicateVersionPublish` handling during the publish itself.

Required for jsr-io/jsr#1270 (private packages).
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