Skip to content

fix: the password is masked in every trace log line; release notes say how to send a trace - #515

Merged
TimelordUK merged 2 commits into
masterfrom
docs/release-trace-note
Oct 26, 2026
Merged

TimelordUK merged 2 commits into
masterfrom
docs/release-trace-note

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Release notes

.github/RELEASE_TEMPLATE.md gets a standing section, Hit a problem? Send us a trace. It says how to turn on TRACE logging to a file (JS and C++, including the ODBC calls and their results), reproduce, and attach the file to an issue. It also warns that query text, parameter values and rows are logged as they are, so the file should be checked before posting. The configureFor* comments in the older snippet had the wrong levels. They are corrected here and in samples/javascript/simple-logging-config.js.

Password masking

Before asking people for traces, I checked what a TRACE file holds. The password leaked in two places:

  • JS: PrivateConnection.open logged the connection string as given (TRACE).
  • C++: OdbcConnection::Open logged it unmasked (DEBUG).

Separately, the SQLDriverConnect and diagnose lines masked only an upper-case PWD=, up to the first ;. So pwd=, Password= or a braced PWD={a;b} would partly leak.

Now:

  • JS uses maskPassword for the connection string it logs.
  • C++ routes all three sites through StringUtils::SanitizeConnectionString. It matches PWD/Password in any case, only at the start of a field, allows spaces before the =, and skips a braced value to its closing brace (}} escapes).

Verified locally:

  • A TRACE file for PWD=x, pwd = {x} and Password=x has no plaintext line in any of the three.
  • New test/mask-password.test.js passes (7 cases).
  • Pause and cancel suites pass.

Needs a native rebuild (prebuilds come with the release as usual).

🤖 Generated with Claude Code

…s say how to send a trace

The release notes now have a standing section on capturing a TRACE log to
attach to an issue. Before asking for those, the password had to stay out
of them:

- JS: PrivateConnection.open logged the connection string as given at
  TRACE. It is now masked (PWD= or Password=, any case, braced or not).
- C++: OdbcConnection::Open logged it unmasked at DEBUG, and the
  SQLDriverConnect and diagnose lines masked only an upper case PWD= up to
  the first ';'. All three now use StringUtils::SanitizeConnectionString,
  which matches a key only at the start of a field, allows spaces before
  the '=', and skips a braced value to its closing brace.

Also corrects the levels in the configureFor* comments in the template and
the logging sample (development is DEBUG, production INFO, testing TRACE).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread lib/connection.js Fixed
CodeQL flagged the masking regex as polynomial: an unclosed braced value
made the braced branch scan to the end of the string and fail, again at
every ';pwd={'. The connection string is the app's own, so this was not a
practical risk, but a field by field scan is as short and mirrors the C++
StringUtils::SanitizeConnectionString.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@TimelordUK
TimelordUK merged commit bac0e92 into master Oct 26, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants