Skip to content

Find, verify, and analyze leaked credentials

DB is not needed for ping command (#2540)

Dustin Deckerdbf696515270
diff --git a/pkg/detectors/jdbc/mysql.go b/pkg/detectors/jdbc/mysql.go
index a624f41a7..291bc375e 100644
--- a/pkg/detectors/jdbc/mysql.go
+++ b/pkg/detectors/jdbc/mysql.go
@@ -14,13 +14,11 @@ type mysqlJDBC struct {
conn string
userPass string
host string
- database string
params string
}
func (s *mysqlJDBC) ping(ctx context.Context) pingResult {
return ping(ctx, "mysql", isMySQLErrorDeterminate,
- buildMySQLConnectionString(s.host, s.database, s.userPass, s.params),
buildMySQLConnectionString(s.host, "", s.userPass, s.params))
}
@@ -64,8 +62,7 @@ func parseMySQL(subname string) (jdbc, error) {
conn: subname[2:],
userPass: cfg.User + ":" + cfg.Passwd,
host: fmt.Sprintf("tcp(%s)", cfg.Addr),
- database: cfg.DBName,
- params: "timeout=5",
+ params: "timeout=5s",
}, nil
}
@@ -75,8 +72,6 @@ func parseMySQL(subname string) (jdbc, error) {
return nil, err
}
- dbName := strings.TrimPrefix(u.Path, "/")
-
user := "root"
pass := ""
if u.User != nil {
@@ -100,7 +95,6 @@ func parseMySQL(subname string) (jdbc, error) {
conn: subname[2:],
userPass: userAndPass,
host: fmt.Sprintf("tcp(%s)", u.Host),
- database: dbName,
params: "timeout=5s",
}, nil