Crypto: To get unreferenced parameters as general sources for Java, I've included the caveat that if a function is called, all the calls appear to be in test files.

This commit is contained in:
REDMOND\brodes
2025-10-15 14:20:16 -04:00
parent c6174fbb93
commit 9a6aac1300

View File

@@ -55,7 +55,18 @@ final class DefaultRemoteFlowSource = RemoteFlowSource;
private class GenericUnreferencedParameterSource extends Crypto::GenericUnreferencedParameterSource {
GenericUnreferencedParameterSource() {
exists(Parameter p | this = p and not exists(p.getAnArgument()))
exists(Parameter p |
this = p and
(
not exists(p.getAnArgument())
or
// If all calls to a function occur in a test file, ignore those calls
// and consider the parameter to the function a potential source as well.
forall(Call testCall | testCall.getCallee() = p.getCallable() |
testCall.getFile().getBaseName().toUpperCase().matches("%TEST%")
)
)
)
}
override predicate flowsTo(Crypto::FlowAwareElement other) {