Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1641112: Connector throws a user warning about connections.toml CHMOD, even when it will not use that file for connection details #2036

Open
surpatean opened this issue Aug 27, 2024 · 3 comments
Assignees
Labels
enhancement The issue is a request for improvement or a new feature status-triage_done Initial triage done, will be further handled by the driver team

Comments

@surpatean
Copy link

surpatean commented Aug 27, 2024

Python version

Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)]

Operating system and processor architecture

Windows-10-10.0.19045-SP0

Installed packages

snowflake-connector-python==3.12.1

What did you do?

I create a connection:

  • without specifying a TOML connection_name= parameter value,
  • and without connections.toml having a [default] connection either.
con = snowflake.connector.connect(
    account=...,
    user=...,
    private_key=...,
    role=...,
    database=...,
    schema=...,
    session_parameters={'QUERY_TAG': job_name})

A user warning is thrown
lib\site-packages\snowflake\connector\config_manager.py:351: UserWarning: Bad owner or permissions on ~\.snowflake\connections.toml

My system does have a connections.toml file (used by the Snowflake VSCode extension)

["tl...1"]
name = "tl...1"
account = "tl...1"
user = "..."
authenticator = "externalbrowser"
password = ""

but no default connection, and this connection is not requested in connection_name=.

What did you expect to see?

If no TOML connection_name is provided, and connection details are provided in-line instead of via a TOML (default) connection, then the connector should not complain about the CHMOD of this file.

Can you set logging to DEBUG and collect the logs?

2024-08-27 12:33:23,534 - MainThread ssl_wrap_socket.py:44 - inject_into_urllib3() - DEBUG - Injecting ssl_wrap_socket_with_ocsp
2024-08-27 12:33:23,534 - MainThread _auth.py:91 - <module>() - DEBUG - cache directory: ~\AppData\Local\Snowflake\Caches
~\AppData\Local\miniconda3\envs\Glue_Python39_Analytics\lib\site-packages\snowflake\connector\config_manager.py:351: UserWarning: Bad owner or permissions on ~\.snowflake\connections.toml
  warn(f"Bad owner or permissions on {str(filep)}{chmod_message}")
2024-08-27 12:33:23,580 - MainThread config_manager.py:352 - read_config() - DEBUG - reading configuration file from ~\.snowflake\connections.toml
2024-08-27 12:33:23,592 - MainThread connection.py:413 - __init__() - INFO - Snowflake Connector for Python Version: 3.12.1, Python Version: 3.9.18, Platform: Windows-10-10.0.19045-SP0
2024-08-27 12:33:23,593 - MainThread connection.py:730 - connect() - DEBUG - connect
2024-08-27 12:33:23,593 - MainThread connection.py:1114 - __config() - DEBUG - __config
2024-08-27 12:33:23,593 - MainThread connection.py:1196 - __config() - INFO - Connecting to GLOBAL Snowflake domain
@github-actions github-actions bot changed the title Connect throws a user warning about connections.toml CHMOD, even when it should not use that file SNOW-1641112: Connect throws a user warning about connections.toml CHMOD, even when it should not use that file Aug 27, 2024
@surpatean surpatean changed the title SNOW-1641112: Connect throws a user warning about connections.toml CHMOD, even when it should not use that file SNOW-1641112: Connector throws a user warning about connections.toml CHMOD, even when it will not use that file for connection details Aug 27, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Aug 30, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage Issue is under initial triage and removed needs triage labels Aug 30, 2024
@sfc-gh-dszmolka
Copy link
Contributor

hi - thank you for raising this issue with us and providing the details! we'll take a look

@sfc-gh-dszmolka sfc-gh-dszmolka added enhancement The issue is a request for improvement or a new feature and removed bug labels Aug 30, 2024
@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Aug 30, 2024

hello and thank for reporting this issue ! to me, it looks like twofold:

  1. (a bug) permission checking on Windows for the connections.toml seems to be a bit broken. Tracking issue: SNOW-1502056: using connections.toml always returns a "Bad owner or permissions" on UserWarning #1978
    edit: there seems to be some quite useful comments on how to mitigate this bug and the output until it's fixed in the PythonConnector

  2. (an enhancement) if no default connection, nor explicitly pointed connection references this config file during connection, then we shouldn't read it at all

The second we can track on this issue, and I'll keep it updated if there's any progress with it.

@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels Aug 30, 2024
@surpatean
Copy link
Author

Silly of me to not notice that other bug report...
I agree with your bug/enhancement split @sfc-gh-dszmolka

My concern is indeed more about not checking the file if not used in the connection.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is a request for improvement or a new feature status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

3 participants