apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 843 forks source link

Outdated Jcraft JSCH Library Causes Incorrect Credentials For Remote Git Repository #3700

Closed Ojambo closed 2 years ago

Ojambo commented 2 years ago

Apache NetBeans version

Apache NetBeans 12.6

What happened

Originally reported on 2021-09-27 here https://issues.apache.org/jira/browse/NETBEANS-6067

I am running Fedora 35 and NetBeans 12.6 and just upgraded to 13. I get incorrect credentials when I attempt a git push. It works fine on the command line so I can up with a workaround until this issue is resolved. A quick alternative for Netbeans is to use a fork of JSch-01.55 here https://github.com/mwiede/jsch that is actually updated allowing modern encryption algorithms.

Workaround: Perform a commit using the GUI in NetBeans then on the command line run "git push" in the folder containing your project and/or local git repository.

Problems:

References:

  1. Matez Blog the future of jsch without ssh-rsa https://www.matez.de/index.php/2020/06/22/the-future-of-jsch-without-ssh-rsa
  2. Bug 520927: moving away from JSch https://www.eclipse.org/lists/jgit-dev/msg03696.html
  3. Gerrit 3.4.0 Disables JCraft JSch client library by default https://www.gerritcodereview.com/3.4.html
  4. JSch Last SourceForge Update https://sourceforge.net/projects/jsch/files/jsch/
  5. Invalid Private Key When Using JSch https://stackoverflow.com/questions/53134212/invalid-privatekey-when-using-jsch

How to reproduce

Git push will result in incorrect credentials in Netbeans if using recent versions of OpenSSH on the remote server or stronger encryption methods.

Did this work correctly in an earlier version?

No

Operating System

Locally Linux Fedora 35: Remotely Debian 11, and CentOS 7.9

JDK

OpenJDK 11.0.14.1

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

This occurs for every GIT Push. I also tried locally it without port numbers from a laptop to the work station both running Fedora 35. The cause is that the jcraft JSCH library is old. Google already moved away from it and Eclipse is in the process of replacing it

I have attached a message.log file after removing the original remote repository.

username_netbeans_13_var_log_messages.log .

Are you willing to submit a pull request?

No response

Code of Conduct

Yes

mbien commented 2 years ago

@Ojambo thank you for the detailed report.

I personally prefer to use the shell for most git tasks so I never noticed. I put NB 14 milestone on this issue since i think we should try to fix this if there is time/interest.

matthiasblaesing commented 2 years ago

I created a pull request and here is a test build:

https://doppel-helix.eu/NetBeans-dev-dev-ff00b6542e7a8c5e8fa39a0d8f0df663b7061e0f-release.zip

I tested ecdsa and ed25519 keys on linux. Support for SSH Agents was only tested with an rsa key on Windows and Linux (PAgent and SSHAgent). The ssh bundle was marked to depend on:

The updated SSH library integrates support for agent integration, so the dedicated NetBeans modules was removed.

Ojambo commented 2 years ago

I tested the DEV version and was able to successfully perform a GIT push in the IDE. The fix should also take care of Issue newer ssh keys not accepted for remote synchronization #3691 https://github.com/apache/netbeans/issues/3691

norrisjeremy commented 2 years ago

As on the caretakers of this newer JSch fork, please let me know if you have any questions about integrating it.

q3769 commented 2 years ago

Hi, for the current 13 release, is there some jar files I could download and replace to make the GitHub push work? Thanks!

mbien commented 2 years ago

@q3769 the easiest way would be to simply use a RC build https://www.mail-archive.com/dev@netbeans.apache.org/msg10693.html

q3769 commented 2 years ago

@q3769 the easiest way would be to simply use a RC build https://www.mail-archive.com/dev@netbeans.apache.org/msg10693.html

Thank you!