Skip to content

Commit

Permalink
clairctl: Remove DSN logging
Browse files Browse the repository at this point in the history
This can leak the DB password into the application logs.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
  • Loading branch information
crozzy committed Jun 30, 2023
1 parent 89cae77 commit c636e20
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/clairctl/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ func adminPre470(c *cli.Context) error {
return fmt.Errorf("error loading config: %w", err)
}
dsn := cfg.Indexer.ConnString
zlog.Info(ctx).
Str("dsn", dsn).
Msg("using discovered connnection string")

pgcfg, err := pgxpool.ParseConfig(dsn)
if err != nil {
return fmt.Errorf("error parsing dsn: %w", err)
}
zlog.Info(ctx).
Str("host", pgcfg.ConnConfig.Host).
Str("database", pgcfg.ConnConfig.Database).
Str("user", pgcfg.ConnConfig.User).
Uint16("port", pgcfg.ConnConfig.Port).
Msg("using discovered connection params")

zlog.Debug(ctx).
Msg("resizing pool to 2 connections")
pgcfg.MaxConns = 2
Expand Down

0 comments on commit c636e20

Please sign in to comment.