fix(security): synchronize report lifecycle and current roles

Revalidate admin roles from the database and serialize report generation registration with owner-scoped deletion.

Refs #9

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 21:35:38 +01:00
parent 0ebc531124
commit 609dbff7c1
16 changed files with 668 additions and 35 deletions

View File

@ -36,6 +36,8 @@ func TestArticleCapsMigrationAndInvalidAdminUpdatesAreAtomicPostgres(t *testing.
t.Fatal(err)
}
for _, statement := range []string{
`CREATE TABLE users (id TEXT PRIMARY KEY,email TEXT,password_hash TEXT,role TEXT,created_at TIMESTAMPTZ DEFAULT NOW(),updated_at TIMESTAMPTZ DEFAULT NOW())`,
`INSERT INTO users(id,email,password_hash,role) VALUES ('admin-id','admin@example.test','hash','admin')`,
`CREATE TABLE settings (key TEXT PRIMARY KEY, value TEXT NOT NULL)`,
`CREATE TABLE sources (id UUID PRIMARY KEY, name TEXT NOT NULL, type TEXT NOT NULL, enabled BOOLEAN NOT NULL DEFAULT TRUE, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW())`,
`CREATE TABLE scrape_schedules (id UUID PRIMARY KEY, day_of_week INT NOT NULL, hour INT NOT NULL, minute INT NOT NULL)`,