-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Java: Extract module HardcodedCredentials from CWE-798 #3992
base: main
Are you sure you want to change the base?
Conversation
The SensitiveApi library is renamed to CredentialReceivingApi to specify its usage, because without context sensitive api is too general.
This enables customizations to extend the notion of a username or password variable.
java/ql/src/semmle/code/java/security/CredentialReceivingApi.qll
Outdated
Show resolved
Hide resolved
Co-authored-by: intrigus-lgtm <60750685+intrigus-lgtm@users.noreply.github.com>
*/ | ||
abstract class CredentialsSink extends Expr { | ||
/** An argument to a sensitive call, expected to contain credentials. */ | ||
abstract class CredentialsSink extends DataFlow::Expr { |
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.
abstract class CredentialsSink extends DataFlow::Expr { | |
abstract class CredentialsSink extends Expr { |
The type Expr
is not intentionally exposed through the DataFlow
module (though with all the import java
statements it's no surprise that it slipped in).
What is the use case for this PR? Which of the queries need support for extension and in which ways? And which parts of the moved library are expected to be re-usable in other contexts outside the CWE-798 queries? |
For this case there is no immediate use case. I'm making all possible extension points (e.g, source, sinks, ...) in the |
In general, queries have an infinite number of possible extension points, although I agree that for most cases it comes down to source and sink extensions. The way these queries are made, means that there's an implicit assumption that |
True, I indeed mean the more common cases.
Clear, I agree that |
This PR needs some scrutinizing.
In this change we:
HardcodedCredentials
to an importable locationSensitiveApi
toCredentialReceivingApi
and move it to an importable locationCredentialSink
fromDataFlow::Expr
instead ofExpr
UsernameVariable
andPasswordVariable