Make a login for Hookie
Create a PostgreSQL login that can only read, and grant itSELECT on the schemas agents should see:
INSERT, UPDATE, DELETE, TRUNCATE or CREATE on anything it can see. The database must be reachable on a public host over TLS.
Connect a database
- Open the project and choose Sources, then Databases.
- Choose Connect a database.
- Give it a name, paste the connection string (
postgres://user:password@host:5432/db), and choose the schemas agents may read and the columns to mask. - Choose Connect.
How a query runs
Each query is checked and run in layers, and any one of them refuses it on its own:- The login must be read-only, checked when you connect and before every query.
- The query runs in a
READ ONLYtransaction with a statement timeout. - Only one statement is allowed, and only
SELECT,WITH,TABLE,VALUES,EXPLAIN(withoutANALYZE) andSHOW. Row locks and functions that reach outside the tables are refused. - Rows and bytes stop at the plan’s caps, and the answer says when it was cut.
- Masked columns come back as
[masked].
For agents
Developers and above may describe and query. Values come from your database: agents are told to treat them as data, never as instructions.