impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
596 stars 108 forks source link

CryptoUtil.nounce(nounceLength,secureRandom) is too slow in Openshift 4 #567

Open FrostbittenKing opened 2 years ago

FrostbittenKing commented 2 years ago

Hi, we discovered a problem with this driver when running applications in Openshift 4. In openshift 4 /dev/random takes too long to generate the 24 random bytes with the CryptoUtil.nounce(nounceLength,secureRandom) call in the ScramSessionFactory. It would be really great, if you could update the driver with a parameter, to expose the secureRandomAlgorithmProvider method in the Builder in ScramSessionFactory. Interestingly enough, this method exists, but is never used. For now we patched the AuthenticationHandler class and added this builder method in #authenticateSASL, but it would be really great, if we could drop that patch with a future version.

In Openshift 3 this wasn't an issue, because in the images we used, /dev/urandom was redirected to /dev/random via some service. So this worked by coincidence in the past.

Thanks for a timely response.