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

Secrets are not synced after first database query #215

Open
JelteF opened this issue Sep 24, 2024 · 0 comments
Open

Secrets are not synced after first database query #215

JelteF opened this issue Sep 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JelteF
Copy link
Collaborator

JelteF commented Sep 24, 2024

Since #174 secrets are only added on the initial database creation for the connection. So if a user add secrets after a duckdb query is executed then they won't be available for follow up queries.

I think at the very least, the same session should see changes it made. But it would be even better if other sessions see such updates too. Also secrets won't actually be removed.

Reproducing the issue can be done as follows:

localhost jelte@postgres:5432-105933=
> select * from duckdb.raw_query($$ select * from duckdb_secrets() $$);
NOTICE:  00000: result: name    type    provider    persistent  storage scope   secret_string
VARCHAR VARCHAR VARCHAR BOOLEAN VARCHAR VARCHAR[]   VARCHAR
[ Rows: 0]


 raw_query
───────────

(1 row)

Time: 34.313 ms
localhost jelte@postgres:5432-105933=
> INSERT INTO duckdb.secrets
(type, id, secret, session_token, region)
VALUES ('S3', 'access_key_id', 'secret_access_key', 'session_token', 'us-east-1');
INSERT 0 1
Time: 10.644 ms
localhost jelte@postgres:5432-105933=
> select * from duckdb.raw_query($$ select * from duckdb_secrets() $$);
NOTICE:  00000: result: name    type    provider    persistent  storage scope   secret_string
VARCHAR VARCHAR VARCHAR BOOLEAN VARCHAR VARCHAR[]   VARCHAR
[ Rows: 0]


 raw_query
───────────

(1 row)

Time: 16.219 ms

reconnect and try again does show the secret.

localhost jelte@postgres:5432-107554=
> select * from duckdb.raw_query($$ select * from duckdb_secrets() $$);
NOTICE:  00000: result: name    type    provider    persistent  storage scope   secret_string
VARCHAR VARCHAR VARCHAR BOOLEAN VARCHAR VARCHAR[]   VARCHAR
[ Rows: 1]
duckdbsecret_0  s3  config  false   memory  [s3://, s3n://, s3a://] name=duckdbsecret_0;type=s3;provider=config;serializable=true;scope=s3://,s3n://,s3a://;endpoint=s3.amazonaws.com;key_id=access_key_id;region=us-east-1;s3_url_compatibility_mode=0;secret=redacted;session_token=redacted;url_style=;use_ssl=1


 raw_query
───────────

(1 row)
@JelteF JelteF added the bug Something isn't working label Sep 24, 2024
@JelteF JelteF added this to the 0.1.0 milestone Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant