Repository navigation
fix(sql): redact passwords in connection URI errors - #1067
Conversation
| } catch (const std::exception& e) { | ||
| return IOError("Failed to connect to PostgreSQL '{}': {}", options.uri, e.what()); | ||
| return IOError("Failed to connect to PostgreSQL '{}': {}", | ||
| RedactConnectionUri(options.uri), e.what()); |
There was a problem hiding this comment.
The URI is redacted, but e.what() is still treated as safe. With sqlpp23 0.69, a password containing whitespace is passed unquoted in libpq conninfo; libpq can then include the following password fragment in its parse error. Sanitize or replace the driver text, and add a factory-level regression test using a password such as secret fragment.
There was a problem hiding this comment.
Fixed in 90f9f40. PostgreSQL and MySQL connection failures no longer append driver-provided e.what(), which can contain password fragments from libpq conninfo parsing. Added a PostgreSQL factory-level regression test with secret fragment; it asserts neither the password nor the leaked fragment appears in the returned error.
Superseded by the latest request-changes review.
Summary
@in passwords, path delimiters, and parse failures.