-
Notifications
You must be signed in to change notification settings - Fork 118
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
Check for CWE-337 #439
Check for CWE-337 #439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add acceptance tests for this check! Also, reusing code from the CWE-476 check means that the analysis is dependent on the Pointer Inference analysis, so we have to tell the caller code that the Pointer Inference analysis has to be computed before this check.
* Add "artifical_sample" * Rename `sinks` to `seeding_functions` * Use `expect()` instead of `unwrap()` for the `Config` * Bail early if either there are no sinks or no sources * Only use one `computation` instead of one per call to a source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only two minor things to fix remaining before we can merge the check.
Edit: Oops, I forgot something important! We also have to add the check to the list of checks in the project Readme!
Implements a check for CWE-337: Predictable Seed in Pseudo-Random Number Generator (PRNG)
The check works by reusing the taint-tracking code from the check for CWE-467 to track return values of "source" functions (e.g.:
time
) to arguments of "sink" functions (e.g:srand
).