supabase / vault

Extension for storing encrypted secrets in the Vault
Apache License 2.0
163 stars 9 forks source link

Adding vault extension with local Supabase development #2

Open drewbietron opened 1 year ago

drewbietron commented 1 year ago

Bug report

Describe the bug

While adding the vault extension to a local Supabase development environment, the extension cannot be found and/or installed.

To Reproduce

Add migration file and then run migration in local Supabase database.

CREATE SCHEMA vault;
CREATE EXTENSION supabase_vault WITH SCHEMA vault;
ERROR: could not open extension control file "/usr/share/postgresql/14/extension/supabase_vault.control": No such file or directory (SQLSTATE 58P01)

Expected behavior

Am able to add the extension locally so that Supabase vault secrets that are depended on in other migration or database logic are available.

Additional context

The extension is also not available in the local Supabase Studio Extension UI. This is running the Supabase CLI v1.4.9. Have also upgraded the CLI to v1.11.2 and the problem still exists.

Have also tried running this per this blog post (which has a different extension name than this repo), but with no luck.

create extension vault with schema vault;
michelp commented 1 year ago

Vault is not generally released yet on production but stay tuned! We're in the final stages of testing it as well as the new UI.

drewbietron commented 1 year ago

Saw that the docs were updated since this was announced recently. However I am still not able to install this extension locally.

CREATE EXTENSION supabase_vault CASCADE;
ERROR: could not open extension control file "/usr/share/postgresql/14/extension/supabase_vault.control": No such file or directory (SQLSTATE 58P01)
selbyk commented 1 year ago

I just updated all my supabase and docker images, and I also cannot install vault locally.

Migration

CREATE EXTENSION supabase_vault CASCADE;

Result

Error: ERROR: extension "supabase_vault" is not available (SQLSTATE 0A000)
simbas commented 1 year ago

@drewbietron, @selbyk; I just try it locally today, after upgrading supabase (brew upgrade supabase) and restarting supabase services (supabase stop && supabase start), it seems available now.

supabase --version
1.38.7

here is my migration file:

CREATE EXTENSION supabase_vault CASCADE;

insert into vault.secrets
(secret, name, description)
values
  ('s3kr3t_k3y', 'secret_name', 'secret description.');

Running the following query select decrypted_secret from vault.decrypted_secrets from the SQL Editor dashboard result in:

decrypted_secret
s3kr3t_k3y
Marviel commented 1 year ago

AFAICT -- vault is not currently available in the CLI (Supabase CLI v1.42.5) based on this reversion: https://github.com/supabase/postgres/commit/10ab1889b9434adabad25f6b8bdb9eb39eca110a

nlarusstone commented 1 year ago

Note that it is enabled again https://github.com/supabase/postgres/pull/598 (worked for me under CLI version 1.50.4)