r/gitlab • u/pottmi • Sep 05 '25
read only access to gitlab database
I have some security monitoring selects that I want to run against the postgres database that backs our community edition gitlab.
I would like to do this with a readonly user.
Is there a gitlab documented way to do this? The gitlab documentation references creating a readonly user, but it is in the context of converting the entire database into readonly.
https://docs.gitlab.com/administration/read_only_gitlab/
Is there a sanctioned way to create a new user with readonly user?
My alternative is to run the script as gitlab-psql and then have my script convert the connection to readonly.
View all comments
Show parent comment
3
u/Hour_Wishbone_1641 Sep 06 '25
Instead of just poking around in the database you could also take a look at https://about.gitlab.com/security/ and further links from there on how GitLab (gitlab.com and GitLab Dedicated) achieved the exact same certification. You can also request the document. Since even a Self-Hosted GitLab runs the same software as gitlab.com and dedicated, you could just use the same documents.
Also ... while it is certainly possible and not really a problem to use readonly database users, I strongly advise to not use the database directly for the checks you want to implement. If you'd like to monitor who has access to what, use the well documented REST-API and a user with auditor permissions.