Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

chore: update broken package-lock resolves #886

Merged

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Feb 14, 2021

Some package-lock.json files had were using an npm mirror from netflix that is no longer working. For example https://artifacts.netflix.com/api/npm/npm-netflix/@babel/code-frame/-/code-frame-7.0.0.tgz is broken and it should use registry.npmjs.org. So I ran:

perl -i -p -e 's/https:\/\/artifacts\.netflix\.com\/api\/npm\/npm-netflix/https:\/\/registry.npmjs.org/' `git ls-files **/package-lock.json`

and then was able to run npm install normally and everything completed alright.

Copy link

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, This was suppose dto say "how is this the failure mode? Deleted all package locks?" Should that be updated?

Copy link

@punya punya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. Are we pulling from any mirrors other than registry.npmjs.org elsewhere in our lockfiles? I'm curious if the addition of netflix as a mirror was intentional, was reviewed in the appropriate way, and if we have safeguards to prevent accidental or malicious introduction of mirrors in future.

@aabmass
Copy link
Member Author

aabmass commented Feb 16, 2021

Are we pulling from any mirrors other than registry.npmjs.org elsewhere in our lockfiles?

@punya not anymore:

$ pcregrep -h -o1 '\"resolved\": \"https:\/\/(.+?)\/' `git ls-files **/package-lock.json` | sort | uniq
registry.npmjs.org

I'm curious if the addition of netflix as a mirror was intentional, was reviewed in the appropriate way, and if we have safeguards to prevent accidental or malicious introduction of mirrors in future

This change was introduced ~2 years ago in #564. The author of the PR works at netflix and judging by this npm package, netflix devs probably are/were using a custom registry, either with --registry http://artifacts.netflix.com/api/npm/npm-netflix or probably in their npmrc file. I think this was commited by mistake and the URLs have just since broken. It doesn't look like we have any safeguards to prevent this in place, created #889.

Also want to point out that package-lock.json files are not distributed on npm when publishing so mirrors can't be maliciously introduced to users (could effect local builds of OC though)

@jsuerth I tried just deleting the package locks first and regenerating but this upgraded a bunch of dependencies and broke the build as well :( so I took the route of replacing the mirror URLs instead. The changes to other lockfiles is npm upgrading the to lockfile version 2 since I am using npm v7.

@aabmass aabmass merged commit d0a825d into census-instrumentation:master Feb 16, 2021
@aabmass aabmass deleted the fix-broken-package-locks branch February 16, 2021 15:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants