-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(install): use ssh keys for private git repos #11917
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
❌ @Eckhardt-D, your commit has failing tests :( 🪟💻 1 failing tests Windows x64 baseline
🪟💻 3 failing tests Windows x64
|
This comment was marked as resolved.
This comment was marked as resolved.
@dylan-conway This commit be70b4d introduces quite a bit of changes for caveats I found in the initial implementation:
Again, the code is probably not the best (first time Zigging) - but it does what I am trying to convey:
The biggest thing is that previously the One edge case this caused and that is addressed is that if an https URL is not a valid git repo, it would also not report the error - currently my fix is to read from |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This seems like the correct approach, npm does the same thing https://github.com/npm/cli/blob/22731831e22011e32fa0ca12178e242c2ee2b33d/node_modules/pacote/lib/git.js#L82-L84
There might be something we can find in npm's codebase for how they choose to fallback to ssh |
NPM Also Looks for a specific message in the stderr of the response and converts it to a different error, however - they use This adds yet another network call to the process 🐌 given that ultimately there will be an error in the ssh call after the https try, if the stderr output ever changes, the only side effect would be that Bun unnecessarily tries ssh after https, which I think is better than ALWAYS running ls-remote? |
Looking at the crash report, it looks like the exception is coming from |
checks for .git extension and removes bitbucket from test because bitbucket still does an ssh key check even on public repos
fixes the issue where private SCP like items would always fail because never tried with ssh. removes the need for Bun to know if a URL is private or public by trying both.
After #11917 (comment) and #11917 (comment) are addressed this pr should be almost ready to go. There is one new CI failure in |
Actually it's not new, seeing it here as well #12022 (comment) |
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
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.
Looks good, thank you!
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
|
What does this PR do?
Fixes #11993
Fixes #10641
Fixes #6927
Fixes #2464
Fixes #4068
Do not convert SCPLike and ssh:// urls to https URLs so that the system can use ssh keys when the resolution prefix is ssh:// - check if the host is in known hosts after git@. NB, not 100% sure if the skipping of verifyResolutions for .git tag is the way to go, might need some help there.
How did you verify your code works?
I ran bun install
<private-repo-url>
on a few private repo packages I have access to on different platforms.and also had a package.json test as follows:
☝️ No, because it's dependent on ssh keys.
Caveat
This is the first time I ever wrote Zig so it may be a good idea to double check my work 🤣 especially what I did in
src/install/lockfile.zig
, I could not for the life of me figure out why verifyResolutions is failing so I silenced it for git repos basically, don't think that's the way to go.