Skip to content
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

[Bug] yarn up does not properly update non-npm dependencies #1492

Open
1 task
andreialecu opened this issue Jun 17, 2020 · 4 comments
Open
1 task

[Bug] yarn up does not properly update non-npm dependencies #1492

andreialecu opened this issue Jun 17, 2020 · 4 comments
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@andreialecu
Copy link
Contributor

  • I'd be willing to implement a fix

Describe the bug

Running yarn up pkg where pkg is a git dependency removes the git dependency and replaces it with a npm dependency.

To Reproduce

Reproduction
await yarn('init', '-y');
await yarn('add', 'left-pad@left-pad/left-pad');
await yarn('up', 'left-pad')

expect(require("./package.json").dependencies["left-pad"]).toEqual("left-pad/left-pad")
@andreialecu andreialecu added the bug Something isn't working label Jun 17, 2020
@andreialecu
Copy link
Contributor Author

This is particularly dangerous if a dependency's name is something common (eg. utils) and unrelated to the utils on npm .

I think the expected behavior or yarn up pkg would be to refresh pkg to the latest commit available without changing its resolution.

Low risk, but in theory, a malicious package could be created on npm to target some internal package used at some company, and run some install script once someone runs yarn up project1-utils. (think previous employee with knowledge of internal package names, etc)

@yarnbot yarnbot added the reproducible This issue can be successfully reproduced label Jun 17, 2020
@yarnbot

This comment has been minimized.

@paul-soporan paul-soporan changed the title [Bug] yarn up does not properly update git dependencies [Bug] yarn up does not properly update non-npm dependencies Nov 3, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Nov 3, 2020

This issue reproduces on master:

Error: expect(received).toEqual(expected) // deep equality

Expected: "left-pad/left-pad"
Received: "^1.3.0"
    at module.exports (evalmachine.<anonymous>:6:60)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)

@brunoclima
Copy link

I'm also getting an error [YN0027] when trying to update a private package using a git+ssh url. But when I put the entire package-name@remote-url like I did in yarn add, it updates just fine. I tought he used the same package name to resolve the url in my package.json. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
Development

No branches or pull requests

3 participants