mirror of
https://github.com/github/codeql.git
synced 2026-03-01 05:13:41 +01:00
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.
21 lines
638 B
Java
21 lines
638 B
Java
package test.cwe798.cwe.examples;
|
|
|
|
import java.sql.DriverManager;
|
|
import java.sql.SQLException;
|
|
|
|
public class CredentialsTest {
|
|
private static final String p = "123456"; // hard-coded credential (flow source)
|
|
|
|
public static void main(String[] args) throws SQLException {
|
|
String url = "jdbc:mysql://localhost/test";
|
|
String u = "admin"; // hard-coded credential (flow source)
|
|
|
|
DriverManager.getConnection(url, u, p); // $ HardcodedCredentialsApiCall
|
|
test(url, u, p);
|
|
}
|
|
|
|
public static void test(String url, String v, String q) throws SQLException {
|
|
DriverManager.getConnection(url, v, q); // $ HardcodedCredentialsApiCall
|
|
}
|
|
}
|