Skip to content

Commit

Permalink
fix(Git): Work around a bug with JGit vs MINA
Browse files Browse the repository at this point in the history
Also see [1] for some more background information about why SSH
connections can otherwise block "if there is less entropy available than
requested".

As a safety measure, this is only done on Linux to not cause any
unintended slow-down on Windows, also see [2].

[1]: https://stackoverflow.com/a/59097932/1127485
[2]: https://www.baeldung.com/java-security-egd#testing-the-effect-of-javasecurityegd

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jan 30, 2025
1 parent 3112d9d commit 2d5e526
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/version-control-systems/git/src/main/kotlin/Git.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ class Git(
) : VersionControlSystem() {
companion object {
init {
if (Os.isLinux) {
// Work around a bug in Apache MINA sshd, see https://github.com/eclipse-jgit/jgit/issues/135.
System.setProperty("java.security.egd", "file:/dev/./urandom")
}

// Make sure that JGit uses the exact same authentication information as ORT itself. This addresses
// discrepancies in the way .netrc files are interpreted between JGit's and ORT's implementation.
CredentialsProvider.setDefault(AuthenticatorCredentialsProvider)
Expand Down

0 comments on commit 2d5e526

Please sign in to comment.