Files
codeql/java/ql/test/query-tests/security/CWE-798/semmle/tests/HardcodedApacheFtpCredentials.java
Chris Smowton b62e9dc92c Convert tests to inline expectations and fix one bug revealed doing so
Specifically Apache sshd defines its sensitive api calls on an inherited interface, and they need to be described that way for us to pick them up.
2022-08-13 14:02:05 +01:00

13 lines
519 B
Java

import org.apache.commons.net.ftp.FTPClient;
import java.io.IOException;
public class HardcodedApacheFtpCredentials {
public static void main(FTPClient client) {
// BAD: Hardcoded credentials used for the session username and/or password.
try {
client.login("username", "password"); // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
client.login("username", "password", "blah"); // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
} catch(IOException e) { }
}
}