# Safety for connected assistants

A coding assistant with access to a database is useful and risky. It can be tricked by text it reads, and it can make a mistake at speed. This page lists what Rezin Core does about both, and what it does not promise.

## Start with the least

A new connection, and a new token, start as:

| Setting | Starts as | To widen it |
|---|---|---|
| What it may do | Look only | Choose "look and change" |
| What it reaches | Nothing, until you tick a project or company | Tick more |
| Production projects | Out of reach | Tick "May reach production projects" |
| Deploying functions | No | Tick "May deploy functions" |
| Private-looking values | Hidden | Tick "Show private-looking values" |

Choices are fixed once made. To change what a connection may do, disconnect it and connect again.

## Mark your production project

In the console, under **Connect → Assistants and approvals**, an owner can mark a project as **production**. From that moment:

- A connection or token reaches it only if its owner ticked **May reach production projects**. One that was made without the tick stops reaching it at once.
- Choosing a production project by name without the tick is refused, so you never make a connection that silently cannot work.
- The list of projects tells the assistant which ones are production and whether it can reach them.

## Changes wait for a person on production

On a production project, an assistant does not change things directly. When it runs SQL that writes, applies a migration, or deploys a function, **nothing runs**. The exact statement or code is kept and the assistant is told it is waiting.

An owner opens **Connect → Assistants and approvals**, reads what was asked, and presses **Approve and run** or **Refuse**.

- Approving runs it at once, exactly as shown, as the project's own confined database role. A statement or a migration runs in one transaction: if any part fails, nothing is changed and the reason is kept.
- A change can be decided once, and runs out after 7 days if nobody decides.
- Other kinds of change (setting a secret, changing or deleting a function, running a function) are refused on production through the connector. Make them in the console.
- Both the asking and the deciding are on the project's record, with the connection's name and the owner's.
- The assistant can call `list_pending_changes` to see whether its change was approved.

An owner can switch approval off for a project. Rezin Core advises against it, and the page shows a warning while it is off. Approval applies to assistants. A person using the `rezin` command-line tool with a token that reaches production is not held in the queue.

## What it reads is marked as data

Rows, log lines, file names and function code are written by your application's users, and may contain text aimed at an assistant: "ignore your instructions and ...". The connector cannot stop an assistant from reading it, so it makes sure it is never mistaken for an instruction:

- Every answer that holds a project's own data begins with a notice saying it is untrusted content, not instructions, and the data sits inside a marked block.
- Nothing in a row can change what a connection is allowed to do. Permissions are checked on the server for every call, against what you chose.

## Private-looking values are hidden

Unless you ticked "Show private-looking values", the connector masks:

- Columns whose names suggest something private: email, phone, address, names, password, token, secret, key, card, date of birth and similar.
- Values that look like an email address, a key or token, or a card number, whatever the column is called. Renaming a column in the query does not get a value past the mask.

The answer says which columns were hidden. Masking applies to SQL results through the connector. It is a filter on what is shown, not a guarantee: a value that does not look private is shown.

## Limit a connection to certain tables

A connection can be given a list of tables it may only touch, and a list it may never touch. Then:

- It sees only those tables in listings, types and access rules.
- SQL is checked before it runs: the names in the statement and the database's own plan for it must stay inside the allowed tables, including through views and sub-queries.
- It may only read rows and add, change or delete them, one statement at a time. It cannot change the structure of the database, apply migrations, or call the project's own functions or functions that run other statements.

## What no tool can reach

These are closed at the database itself, not by a filter:

- Your application's accounts, password hashes, sessions and sign-in records.
- Secret values. A tool can list names and set a value, never read one.
- Keys, access tokens and other connections.
- Any other project, and Rezin Core's own tables.

SQL through the connector runs as the project's confined database role, which has no rights outside the project's own tables.

## Limits

- 120 requests and 20 changes a minute for each connection.
- At most 200 rows from one statement.
- A statement that runs too long is stopped; closing the request stops it too.

## What this does not promise

- An assistant with "look and change" on a project that is not marked production can change and delete that project's data. Keep assistants on a development project, and mark production.
- Whatever an assistant is shown goes to the company that runs it.
- Masks and table limits narrow what a connection is shown. The walls are the ones underneath: what you ticked, the project's own database role, and the approval queue.
