-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
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
[Bug]: Using java.util.Random to generate XIDs for distributed transactions is not secure enough #40262
Comments
@gabilang Are we considering a security purpose here Line 35 in 62804bb
SecureRandom is slower (can say roughly 10x or 20x) than Random and use higher memory. Anyway we can do this change to mitigate the warning.
|
A transaction ID is used to uniquely identify a transaction and is often used for logging, auditing, and tracking purposes. In addition, transaction IDs may be used to ensure that transactions are executed in the correct order or to prevent duplicate transactions from occurring. It's important that transaction IDs are secure to prevent unauthorized access or tampering with sensitive data. An attacker who is able to guess or predict a transaction ID could potentially access or modify sensitive data, impersonate a user, or perform other unauthorized actions. For example, if a transaction ID is simply a sequential number, an attacker could guess the next ID in the sequence and create a fake transaction that would be accepted by the system. To ensure the security of transaction IDs, they should be generated using a secure random number generator, Java provides |
Thanks a lot for the clarification! |
This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now. |
Description
In
ballerina-lang/bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/transactions/XIDGenerator.java
Line 35 in 62804bb
java.util.Random
does not provide sufficient security for the applications which are needed high assurance. We can usejava.security.SecureRandom
instead.Steps to Reproduce
No response
Affected Version(s)
No response
OS, DB, other environment details and versions
No response
Related area
-> Runtime
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: