Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Promote Insecure RNG Query#455

Merged
sauyon merged 4 commits intogithub:mainfrom
sauyon:insecure-rng
Feb 6, 2021
Merged

Promote Insecure RNG Query#455
sauyon merged 4 commits intogithub:mainfrom
sauyon:insecure-rng

Conversation

@sauyon
Copy link
Contributor

@sauyon sauyon commented Jan 19, 2021

Note I moved the WeakCryptoAlgorithm tests along with the insecure randomness ones because they share code.

@sauyon sauyon requested a review from shati-patel January 19, 2021 14:52
@sauyon sauyon requested a review from a team January 19, 2021 14:52
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! How are the results / CVE hits?


override predicate isSink(DataFlow::Node sink) { this.isSink(sink, _) }

predicate isSink(DataFlow::Node sink, string kind) { kind = sink.(Sink).getKind() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs doc comment


override predicate isSink(DataFlow::Node sink) { this.isSink(sink, _) }

predicate isSink(DataFlow::Node sink, string kind) { kind = sink.(Sink).getKind() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
predicate isSink(DataFlow::Node sink, string kind) { kind = sink.(Sink).getKind() }
predicate isSink(Sink sink, string kind) { kind = sink.getKind() }


predicate isSink(DataFlow::Node sink, string kind) { kind = sink.(Sink).getKind() }

override predicate isSanitizer(DataFlow::Node node) { none() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already the default

from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, string kind
where cfg.hasFlowPath(source, sink) and cfg.isSink(sink.getNode(), kind)
select sink.getNode(), source, sink,
"$@ is a value generated with a cryptographically weak RNG used in $@.", source.getNode(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"$@ is a value generated with a cryptographically weak RNG used in $@.", source.getNode(),
"$@ is generated with a cryptographically weak RNG used in $@.", source.getNode(),

Comment on lines 18 to 19
"$@ is a value generated with a cryptographically weak RNG used in $@.", source.getNode(),
"Random number", sink.getNode(), kind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"$@ is a value generated with a cryptographically weak RNG used in $@.", source.getNode(),
"Random number", sink.getNode(), kind
"$@ is generated with a cryptographically weak RNG used in $@.", source.getNode(),
"A random number", sink.getNode(), kind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you want "A random number generated with a cryptographically weak RNG is used in "?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was aiming at "is generated", but that's better

Copy link
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few tiny comments, otherwise LGTM 😃

@sauyon sauyon force-pushed the insecure-rng branch 2 times, most recently from 9ef8d4e to 3d0b09f Compare January 20, 2021 20:02
@sauyon sauyon force-pushed the insecure-rng branch 2 times, most recently from bd33cf7 to 511a143 Compare February 3, 2021 03:41
@sauyon
Copy link
Contributor Author

sauyon commented Feb 4, 2021

The newest commit needs review, I think. I accidentally ran the dist-compare on the old version of this, so that's running again, huzzah.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restriction to first match seems ok to me, one possible cleanup

kind != "a password-related function"
or
sink =
rank[1](DataFlow::PathNode sink2, int line |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rank[1] can become min I think

@sauyon sauyon merged commit a325161 into github:main Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants