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

Access DSN via context? #23

Open
tcolgate opened this issue Jan 5, 2023 · 3 comments
Open

Access DSN via context? #23

tcolgate opened this issue Jan 5, 2023 · 3 comments

Comments

@tcolgate
Copy link
Contributor

tcolgate commented Jan 5, 2023

It would be useful to be able to get hold of the name used in the Open call, from inside the various methods of the interceptor. One option would be to store this on the wrapped connection/connector, and then inject it into the context for retrieval from there.
Interceptors could then parse the name and use it for instrumentation of , for instance, the target db name or host.
Would you have any objections to a PR to implement this? It would mean extra calls to add the context value in every wrapped call, not expensive, but non-zero.

@dolmen
Copy link

dolmen commented Apr 18, 2023

Note: the DSN may contain sensible information that is not wise to keep (ex: DB password), and even less to diffuse through the context.
If the DSN is exposed this will increase the risk of the DSN being leaked in logs.

@tcolgate
Copy link
Contributor Author

Note: the DSN may contain sensible information that is not wise to keep (ex: DB password), and even less to diffuse through the context. If the DSN is exposed this will increase the risk of the DSN being leaked in logs.

Obviously it is down to the user to use the DSN responsibly. They have connected to the DB so the DSN is in memory, there are innumerable other ways the DSN could be leaked. The only way to retrieve the DSN here would be to explicitly retrieve it from the context via this API (and arbitrary logging module would not have access to it).

@2w1nd
Copy link

2w1nd commented Mar 7, 2024

will there be a solution to this problem?

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

No branches or pull requests

3 participants