bcgov / bcgov/entity

Clean up pre-migraton database roles

Open
#29,140 0 comments 0 reactions 1 assignee Claimed by @bolyachevets View on GitHub
SRE
Dominant language
JavaScript
Stars
23
Forks
62
Avg merge
24m
Merged PRs (30d)
1

Description

There may exist in prod databases roles named readonly that have privileges different from the standardized definition established in https://github.com/bcgov/bcregistry-sre/tree/main/gcp/terraform/modules/db_roles/scripts

e.g. Namex Prod DB has readonly roles that grants more access than simple 'select'. When the db is loaded in the datawarehouse these roles are propagated.

Can run this query to check all the grants:

SELECT grantor, grantee, table_schema, table_name, privilege_type
FROM information_schema.table_privileges
WHERE grantee = 'readonly';

-- For schema privileges
SELECT nspname, grantee, privilege_type
FROM pg_namespace
JOIN aclexplode(nspacl) ON true
WHERE grantee = (SELECT oid FROM pg_roles WHERE rolname = 'readonly');

Screenshot 2025-06-23 at 12.45.06 PM.png

There may be other dbs where similar issue exists.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.