Fix server freeze during random token generation

This commit is contained in:
Rene Pfeuffer
2026-01-30 13:50:25 +00:00
committed by Thomas Zerr
parent b6ac1f3668
commit 7b753e0981
2 changed files with 4 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Server freeze during random token generation on startup

View File

@@ -18,17 +18,12 @@ package sonia.scm.lifecycle;
import org.apache.commons.lang.RandomStringUtils;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
final class RandomPasswordGenerator {
String createRandomPassword() {
try {
SecureRandom random = SecureRandom.getInstanceStrong();
return RandomStringUtils.random(20, 0, 0, true, true, null, random);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Every Java distribution is required to support a strong secure random generator; this should not have happened", e);
}
SecureRandom random = new SecureRandom();
return RandomStringUtils.random(20, 0, 0, true, true, null, random);
}
}