Skip to content

Sanitize password in SAP HANA connect statement#15595

Closed
laurit wants to merge 2 commits intoopen-telemetry:mainfrom
laurit:password-sanitize
Closed

Sanitize password in SAP HANA connect statement#15595
laurit wants to merge 2 commits intoopen-telemetry:mainfrom
laurit:password-sanitize

Conversation

@laurit
Copy link
Copy Markdown
Contributor

@laurit laurit commented Dec 10, 2025

No description provided.

@laurit laurit requested a review from a team as a code owner December 10, 2025 16:47
@trask trask added this to the v2.23.0 milestone Dec 10, 2025
strings = {
"CONNECT new_user PASSWORD Password1",
"CONNECT new_user PASSWORD 1Password",
"CONNECT new_user PASSWORD \"Password1\""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could probably be worth adding a few other examples just to be extra-safe:

  • CREATE USER T12345 PASSWORD "Password123"
  • ALTER USER <user_name> PASSWORD "<new_password>"

I haven't done a very exhaustive search here, but there might be a few other cases to cover.

While I'm definitely not familiar with the parser and sanitization logic here, having explicit tests would probably make us sleep better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try a slightly different approach.
The problematic thing here is really that the password can appear unquoted or in double quotes although the db only supports single quotes for string literals. Our sanitizer can easily find quoted string literals but it is harder to find what follows the PASSWORD keyword. It is further complicated by the fact that oracle also allow unquoted passwords but uses IDENTIFIED BY instead of PASSWORD. Also mysql used PASSWORD keyword for something different https://dev.mysql.com/doc/refman/8.4/en/create-user.html and it shouldn't trigger sanitization.

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.

3 participants