-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: verify integrity signature when downloading from npm registry #432
Conversation
@@ -200,7 +204,7 @@ export async function installVersion(installTarget: string, locator: Locator, {s | |||
|
|||
stream.pipe(sendTo); | |||
|
|||
const algo = build[0] ?? `sha256`; | |||
const algo = build[0] ?? `sha512`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why switching to sha512?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that’s what npm registry uses for the signature: they sign a combination of the package name & version and the SHA512 of the package archive. See https://docs.npmjs.com/verifying-registry-signatures for reference.
Co-authored-by: Maël Nison <nison.mael@gmail.com>
When the user has not provided any hash (so when running
corepack up
/corepack use …
), and the package manager is downloaded from the npm registry, we can verify the signature.Related to #10.
BREAKING CHANGE: attempting to download a version from the npm registry (or a mirror) that was published using the now deprecated PGP signature (Yarn ≤1.22.18, Yarn Berry ≤4.0.0-rc.43, pnpm ≤8.4.0) without providing a hash will trigger an error. Users can disable the signature verification by setting
COREPACK_INTEGRITY_KEYS=""
.