feat(postgress): lab7 bootstrap least-privilege roles

This commit is contained in:
Голиков Maximillian Антон
2026-11-25 11:34:32 +03:00
parent c6fcf73ddd
commit 71c9ded92f
3 changed files with 54 additions and 0 deletions
@@ -0,0 +1,19 @@
-- +goose Up
GRANT SELECT, INSERT ON users, chats, chat_members, messages, message_attachments TO lab_api;
GRANT SELECT, INSERT, DELETE ON sessions, idempotency_keys TO lab_api;
GRANT SELECT, INSERT, UPDATE ON attachments, outbox TO lab_api;
GRANT SELECT ON attachment_variants TO lab_api;
GRANT SELECT, UPDATE ON failed_jobs TO lab_api;
GRANT SELECT, UPDATE ON attachments TO lab_worker;
GRANT INSERT ON attachment_variants, failed_jobs, outbox TO lab_worker;
GRANT SELECT ON attachment_variants TO lab_worker;
GRANT SELECT, UPDATE ON attachments TO lab_reconciler;
GRANT INSERT ON outbox TO lab_reconciler;
-- +goose Down
REVOKE ALL ON users, chats, chat_members, messages, message_attachments, sessions,
idempotency_keys, attachments, outbox, attachment_variants, failed_jobs FROM lab_api;
REVOKE ALL ON attachments, attachment_variants, failed_jobs, outbox FROM lab_worker;
REVOKE ALL ON attachments, outbox FROM lab_reconciler;