feat(release): npm-auth preflight fails closed before publish (#3)#17
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rc match Addresses code-review I1/M1/M2 on the npm-auth preflight (#3): - I1: a naive file://${argv[1]} guard silently skipped main() (and the whole auth check) when the install path had spaces or was symlinked — a publish could proceed with NO auth check. Use pathToFileURL(argv[1]).href. - M1: repurpose the previously-unused node:url import. - M2: anchor the npmrc token match with startsWith so a crafted host segment can't false-pass. Adds an I1 regression test (script run from a path with spaces still exits 1). Verified: node --test 10/10; no-token + spaces-path both exit 1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an npm release-auth preflight that FAILS CLOSED before any tag/build/publish work — so a release never stalls on a browser web-auth timeout. Pure resolveNpmAuth (no network) detects NPM_TOKEN/NODE_AUTH_TOKEN or a ~/.npmrc _authToken; CLI exits 1 (before any whoami) when none. Wired into prepublishOnly ahead of version-sync. Includes RELEASE.md.
Code-reviewed (Fix-then-merge → fixed): robust main() entry guard via pathToFileURL (a naive file://${argv[1]} guard silently skipped the whole check under spaced/symlinked paths), stricter npmrc startsWith match, + an I1 regression test. Verified: node --test 10/10; no-token + spaced-path both exit 1.