Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces security enhancements to prevent sensitive service account private keys in the credentials_base64 parameter from being exposed in SQLAlchemy engine URL representations and logs. It implements a custom _CredentialsHidingURL class to mask this parameter during string rendering and updates the BigQueryDialect to wrap engine URLs when the parameter is present. Documentation is also updated with warnings against exposing private keys in connection strings and using online base64 encoders. The review feedback correctly identifies a performance bottleneck in the custom __hash__ implementation of _CredentialsHidingURL, noting that the override is redundant and can be safely removed to avoid unnecessary object reconstruction.
SQLAlchemy hides only the password when it prints an engine's URL, so repr(engine) showed the service account key passed in credentials_base64. The key is now hidden wherever the password is. The README no longer suggests a website for encoding the key file. Fixes b/581919830
70200ec to
9f6bf91
Compare
SQLAlchemy hides only the password when it prints an engine's URL, so repr(engine) showed the service account key passed in credentials_base64. The key is now hidden wherever the password is.
The README no longer suggests a website for encoding the key file.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes b/581919830 🦕