Skip to content

Commit 69317d1

Browse files
committed
fix(databricks): potential sensitive information exposure in loggin
The `src/databricks/sql/experimental/oauth_persistence.py` file logs token persistence operations at INFO level, including the file path where OAuth tokens are stored. While not the tokens themselves, the file path could be sensitive. More critically, the `DevOnlyFilePersistence` class stores OAuth tokens (access_token and refresh_token) in plaintext JSON without encryption, which is noted as development-only but still presents a risk if misused in production. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
1 parent fb55001 commit 69317d1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/databricks/sql/experimental/oauth_persistence.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ def read(self, hostname: str) -> Optional[OAuthToken]:
4040

4141
# Note this is only intended to be used for development
4242
class DevOnlyFilePersistence(OAuthPersistence):
43+
if not os.environ.get('ENVIRONMENT') == 'dev':
44+
logger.warning('DevOnlyFilePersistence is not intended for production use.')
4345
def __init__(self, file_path):
4446
self._file_path = file_path
4547

4648
def persist(self, hostname: str, token: OAuthToken):
47-
logger.info(f"persisting token in {self._file_path}")
49+
logger.debug(f"persisting token in {self._file_path}")
4850

4951
# Data to be written
5052
dictionary = {

0 commit comments

Comments
 (0)