Access audit of baresql_fx_clinic
26 October 2026, 12:00 UTC · PostgreSQL 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) · 9 logins · BareSQL 0.1.0
1 high
3 medium
1 low
7 logins that read personal data
13 columns with personal data
BareSQL logged in as postgres (a superuser) over an unencrypted connection and read the system catalogs inside one read-only transaction.
It read up to 200 rows of each table to see what the columns hold; the values were looked at in memory and are not in this report.
For every login, the server's own privilege checks were asked about every table and column, and each answer below comes with the grant, membership, ownership or view that gives it.
Findings
HIGH clinic_it can read files on the database server.
server-file-access · clinic_it
Details may run pg_read_file(text) member of pg_read_server_files
MEDIUM clinic_hr can make any role a member of clinic_doctor, which reads personal data.
admin-option · clinic_hr
MEDIUM clinic_billing may grant read access to personal data to other roles.
grant-option-personal · clinic_billing
Details clinic.patients.email clinic.patients.insurance_number
MEDIUM clinic_lab has an MD5 password hash, which is weak and deprecated.
md5-passwords · logins
Details
LOW clinic_lab can use foreign server clinic_lab_server (clinic_fdw) through a user mapping.
foreign-server-mapping · clinic_lab
Who can read personal data
Login Personal data Columns Tables Changes Notes
clinic_auditor postal address date of birth email address health data insurance number person's name national ID number phone number 10 3 0 clinic_drsmith postal address date of birth email address health data insurance number person's name national ID number phone number 10 3 0 clinic_locum postal address date of birth email address health data insurance number person's name national ID number phone number 10 3 0 some only after SET ROLE clinic_frontdesk person's name phone number 3 1 0 clinic_billing email address insurance number 2 1 0 clinic_research health data 2 2 0 clinic_lab email address person's name 1 1 0
Columns and tables count base tables, partitions and materialized views, reached in any way listed below. Changes counts tables with personal data the login can insert into, update, delete from or empty.
Personal data in this database
Column Holds How BareSQL knows Read by
clinic.diagnosis_stats.diagnosismaterialized view · text
health data medium confidence
the column name suggests health data; comes from clinic.visits.diagnosis clinic_research clinic.lab_results.payloadtable · jsonb
email address person's name high confidence
JSON key patient.email holds email address in 20 of 20 sampled values; JSON key patient.email (in 20 of 20 sampled values) is named like email address; JSON key patient.name (in 20 of 20 sampled values) is named like person's name clinic_auditor, clinic_drsmith, clinic_lab, clinic_locum clinic.patients.first_nametable · text
person's name medium confidence
the column name suggests person's name clinic_auditor, clinic_drsmith, clinic_frontdesk, clinic_locum clinic.patients.last_nametable · text
person's name medium confidence
the column name suggests person's name clinic_auditor, clinic_drsmith, clinic_frontdesk, clinic_locum clinic.patients.date_of_birthtable · date
date of birth high confidence
30 of 30 sampled values are plausible dates of birth clinic_auditor, clinic_drsmith, clinic_locum clinic.patients.national_idtable · text
national ID number high confidence
30 of 30 sampled values are national ID numbers (es-dni) clinic_auditor, clinic_drsmith, clinic_locum clinic.patients.emailtable · text
email address high confidence
30 of 30 sampled values are email addresses clinic_auditor, clinic_billing, clinic_drsmith, clinic_locum clinic.patients.phonetable · text
phone number high confidence
30 of 30 sampled values are phone numbers clinic_auditor, clinic_drsmith, clinic_frontdesk, clinic_locum clinic.patients.home_addresstable · text
postal address medium confidence
the column name suggests postal address clinic_auditor, clinic_drsmith, clinic_locum clinic.patients.insurance_numbertable · text
insurance number medium confidence
the column name suggests insurance number clinic_auditor, clinic_billing, clinic_drsmith, clinic_locum clinic.visits.diagnosispartitioned table · text
health data medium confidence
the column name suggests health data; found in partitions clinic.visits_2025 and clinic.visits_2026 clinic_auditor, clinic_drsmith, clinic_locum clinic.visits_2025.diagnosispartition · text
health data medium confidence
the column name suggests health data clinic_research clinic.visits_2026.diagnosispartition · text
health data medium confidence
the column name suggests health data no audited login
Logins
clinic_auditor
member of clinic_doctor (no set) · no password set
Personal data it can read Holds How
clinic.lab_results.payloadtable
email address person's name clinic.patients.first_nametable
person's name clinic.patients.last_nametable
person's name clinic.patients.date_of_birthtable
date of birth clinic.patients.national_idtable
national ID number clinic.patients.emailtable
email address clinic.patients.phonetable
phone number clinic.patients.home_addresstable
postal address clinic.patients.insurance_numbertable
insurance number clinic.visits.diagnosispartitioned table
health data
11 other columns it can read
Column How
clinic.appointments.id granted to clinic_staff through clinic_doctor clinic.appointments.patient_id granted to clinic_staff through clinic_doctor clinic.appointments.starts_at granted to clinic_staff through clinic_doctor clinic.appointments.room granted to clinic_staff through clinic_doctor clinic.lab_results.id clinic.lab_results.patient_id clinic.patients.id clinic.visits.id clinic.visits.patient_id clinic.visits.visit_date clinic.visits.notes
clinic_billing
member of no role · no password set
Personal data it can read Holds How
clinic.patients.emailtable
email address column granted to clinic_billing with grant option clinic.patients.insurance_numbertable
insurance number column granted to clinic_billing with grant option
1 other column it can read
Column How
clinic.patients.id column granted to clinic_billing with grant option
clinic_drsmith
member of clinic_doctor · no password set
Personal data it can read Holds How
clinic.lab_results.payloadtable
email address person's name clinic.patients.first_nametable
person's name clinic.patients.last_nametable
person's name clinic.patients.date_of_birthtable
date of birth clinic.patients.national_idtable
national ID number clinic.patients.emailtable
email address clinic.patients.phonetable
phone number clinic.patients.home_addresstable
postal address clinic.patients.insurance_numbertable
insurance number clinic.visits.diagnosispartitioned table
health data
11 other columns it can read
Column How
clinic.appointments.id granted to clinic_staff through clinic_doctor clinic.appointments.patient_id granted to clinic_staff through clinic_doctor clinic.appointments.starts_at granted to clinic_staff through clinic_doctor clinic.appointments.room granted to clinic_staff through clinic_doctor clinic.lab_results.id clinic.lab_results.patient_id clinic.patients.id clinic.visits.id clinic.visits.patient_id clinic.visits.visit_date clinic.visits.notes
clinic_frontdesk
member of clinic_staff · no password set
Personal data it can read Holds How
clinic.patients.first_nametable
person's name column granted to clinic_frontdesk clinic.patients.last_nametable
person's name column granted to clinic_frontdesk clinic.patients.phonetable
phone number column granted to clinic_frontdesk
5 other columns it can read
Column How
clinic.appointments.id clinic.appointments.patient_id clinic.appointments.starts_at clinic.appointments.room clinic.patients.id column granted to clinic_frontdesk
clinic_hr
member of clinic_doctor (no inherit, no set, admin) · no password set
Reads no personal data.
clinic_it
createrole · member of pg_read_server_files · no password set
Reads no personal data.
Functions that run with someone else's rights (1)
Function Runs as How
pg_read_file(text) server files
On the database server it can: read files (may run pg_read_file(text), member of pg_read_server_files).
clinic_lab
member of no role · password stored as an MD5 hash
Personal data it can read Holds How
clinic.lab_results.payloadtable
email address person's name
2 other columns it can read
Column How
clinic.lab_results.id clinic.lab_results.patient_id
Foreign servers it can use: clinic_lab_server (clinic_fdw).
clinic_locum
member of clinic_doctor (no inherit) · can SET ROLE clinic_doctor, clinic_staff · no password set
Personal data it can read Holds How
clinic.lab_results.payloadtable
email address person's name after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.first_nametable
person's name after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.last_nametable
person's name after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.date_of_birthtable
date of birth after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.national_idtable
national ID number after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.emailtable
email address after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.phonetable
phone number after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.home_addresstable
postal address after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.insurance_numbertable
insurance number after SET ROLE clinic_doctor: granted to clinic_doctor clinic.visits.diagnosispartitioned table
health data after SET ROLE clinic_doctor: granted to clinic_doctor
11 other columns it can read
Column How
clinic.appointments.id after SET ROLE clinic_doctor: granted to clinic_staff after SET ROLE clinic_staff: granted to clinic_staff clinic.appointments.patient_id after SET ROLE clinic_doctor: granted to clinic_staff after SET ROLE clinic_staff: granted to clinic_staff clinic.appointments.starts_at after SET ROLE clinic_doctor: granted to clinic_staff after SET ROLE clinic_staff: granted to clinic_staff clinic.appointments.room after SET ROLE clinic_doctor: granted to clinic_staff after SET ROLE clinic_staff: granted to clinic_staff clinic.lab_results.id after SET ROLE clinic_doctor: granted to clinic_doctor clinic.lab_results.patient_id after SET ROLE clinic_doctor: granted to clinic_doctor clinic.patients.id after SET ROLE clinic_doctor: granted to clinic_doctor clinic.visits.id after SET ROLE clinic_doctor: granted to clinic_doctor clinic.visits.patient_id after SET ROLE clinic_doctor: granted to clinic_doctor clinic.visits.visit_date after SET ROLE clinic_doctor: granted to clinic_doctor clinic.visits.notes after SET ROLE clinic_doctor: granted to clinic_doctor
clinic_research
member of no role · no password set
Personal data it can read Holds How
clinic.diagnosis_stats.diagnosismaterialized view
health data granted to clinic_research clinic.visits_2025.diagnosispartition
health data granted to clinic_research
5 other columns it can read
Column How
clinic.diagnosis_stats.visits granted to clinic_research clinic.visits_2025.id granted to clinic_research clinic.visits_2025.patient_id granted to clinic_research clinic.visits_2025.visit_date granted to clinic_research clinic.visits_2025.notes granted to clinic_research
Everyone (PUBLIC)
What every role can read, including roles created after this audit.
No personal data is open to every role.
Method
Schemas audited: clinic, public. Connection: postgres://[email protected] :5432/baresql_fx_clinic, login method md5.
BareSQL never calls a function written in SQL or a procedural language, never reads views or foreign tables, and never writes. Sampled values are turned into text by their type's own output function, never by a cast, and each table is read on its own, without its partitions or child tables. Views are traced to the columns they read from their stored definitions, without running them.
Every fact in this report is also in audit.json, which baresql diff and baresql audit --baseline compare with a later audit.
Made with BareSQL 0.1.0 · baresql.com · 2026-10-26T12:00:00Z