We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
当在某些安全关键的上下文中使用可预测的随机值时,可能会导致漏洞。
例如,当该值用作:
脆弱代码:
String generateSecretToken() { Random r = new Random(); return Long.toHexString(r.nextLong()); }
解决方案:
替换 java.util.Random 使用强度更高的 java.security.SecureRandom
import org.apache.commons.codec.binary.Hex; String generateSecretToken() { SecureRandom secRandom = new SecureRandom(); byte[] result = new byte[32]; secRandom.nextBytes(result); return Hex.encodeHexString(result); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当在某些安全关键的上下文中使用可预测的随机值时,可能会导致漏洞。
例如,当该值用作:
脆弱代码:
解决方案:
替换 java.util.Random 使用强度更高的 java.security.SecureRandom
The text was updated successfully, but these errors were encountered: