Skip to content

Commit

Permalink
Hide Redis password in error message
Browse files Browse the repository at this point in the history
sebaciv committed Nov 22, 2023
1 parent 0912d96 commit 11e8247
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -50,6 +50,10 @@ trait ConnectionConnectionApi extends NodeConnectionApi {

private final class Auth(username: Opt[String], password: String) extends RedisUnitCommand with ConnectionCommand {
val encoded: Encoded = encoder("AUTH").optAdd(username).add(password).result

// hide password value in error messages
override def toString: String =
s""""AUTH" ${username.mapOr("", u => s""""$u" """)}"<password>""""
}

private object Quit extends RedisUnitCommand with ConnectionCommand {
@@ -60,4 +64,3 @@ trait ConnectionConnectionApi extends NodeConnectionApi {
val encoded: Encoded = encoder("SELECT").add(index).result
}
}

0 comments on commit 11e8247

Please sign in to comment.