-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Ruby: Use additional sensitive data heuristics for CleartextSources #16503
Ruby: Use additional sensitive data heuristics for CleartextSources #16503
Conversation
ac50b35
to
8d9b489
Compare
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.
Just one nitpick, otherwise looks good as long as performance is fine.
HashKeyWriteSensitiveSource() { | ||
exists(DataFlow::CallNode writeNode, SensitiveDataClassification classification | | ||
nameIndicatesSensitiveData(name, classification) and | ||
not classification = SensitiveDataClassification::id() and |
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.
Nitpick: I'd prefer an inclusion test to make it more obvious which categories are considered, and maybe make this a less likely to change inadvertently if we add more classifications in the future, e.g.
not classification = SensitiveDataClassification::id() and | |
classification = [ | |
SensitiveDataClassification::secret(), | |
SensitiveDataClassification::password(), | |
SensitiveDataClassification::certificate(), | |
SensitiveDataClassification::private() | |
] and |
// avoid safe values assigned to presumably unsafe names | ||
not this instanceof NonCleartextSensitive and | ||
nameIndicatesSensitiveData(name, classification) and | ||
not classification = SensitiveDataClassification::id() and |
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.
Ditto the above comment, so perhaps we could move this check out into a helper predicate (isRelevantClassification(SensitiveDataClassification classification)
or similar).
ParameterSensitiveSource() { | ||
exists(SensitiveDataClassification classification | | ||
nameIndicatesSensitiveData(name, classification) and | ||
not classification = SensitiveDataClassification::id() and |
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.
ditto
304c65a
to
31d9d99
Compare
@alexrford Thanks, I have factored out these into a helper predicate |
31d9d99
to
90d6f2e
Compare
Performance has now been resolved. New DCA: https://github.com/github/codeql-dca-main/issues/21834 |
Depends on #16446.
This PR expands
CleartextSources.qll
to use additional sensitive data heuristics besides passwords.Additionally, the cleartext storage and cleartext logging queries allow implicit read steps at sinks.
This finds new results in Railsgoat (https://github.com/github/codeql-team/issues/2367)