Added ownership and app existence validation to the user app secrets routes.

This commit is contained in:
2026-10-09 12:11:42 +02:00
parent 381c229bd4
commit e68f103c29
11 changed files with 129 additions and 37 deletions
@@ -1,11 +1,12 @@
CREATE TABLE user_app_secrets (
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
id UUID DEFAULT gen_random_uuid (),
app_id UUID NOT NULL CONSTRAINT fk_user_app_secrets_app REFERENCES user_apps (id) ON DELETE CASCADE,
secret_hash BYTEA NOT NULL CHECK (
octet_length(secret_hash) = 32
),
expires_at TIMESTAMPTZ NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (id, app_id)
);
CREATE INDEX ix_user_app_secrets_app_id ON user_app_secrets (app_id);