On September 8, P0 Security published When your Snowflake AI agent can query everything you can query. The point is simple and easy to miss: a Snowflake Cortex agent runs under the privileges of the user or role that invoked it. If that warehouse role has broad read access across production tables because nobody got around to scoping it, the agent has exactly the same reach. Give AI a least privilege database role of its own.
Why inherited access is the default problem
When people first connect AI to a database, they usually use whatever account is handy, often their own. For a data engineer or analyst, that account may be able to read nearly everything. It made sense for a person who knows what not to touch. It makes much less sense for an agent that will follow instructions, including instructions hidden in data it reads.
As P0 puts it, agents don’t renegotiate access. They use what they’re given.
Dedicated role, or pass the user through
If the tool is user-facing and you can pass that person’s identity through, and their grants are already tight, that’s the better default. I wrote about that in AI agent data leakage and identity. Use a dedicated narrow role when on-behalf-of isn’t possible, which is common for warehouse jobs and shared connectors.
On Snowflake, Restricted Session Scopes can put a privilege ceiling on an agent session so it cannot do more than the caller already can, and often much less. That is a warehouse-specific control. The portable version is still a dedicated role with only the views the use case needs.
How to set up a least privilege database role for AI
- Create a dedicated role for each AI use case. A support assistant and a finance report generator should not share a role.
- Grant read-only access by default. Writes, deletes and schema changes should require a separate, deliberate grant, and usually a human approval step.
- Expose views, not raw tables. Include only the columns and rows the use case needs.
- Log and review queries from AI roles, especially early on.
The connector side of this, including keeping the MCP server off the open internet, is in AI database access control. That’s the canonical post for database connectors. This one is about the role the connector uses.
A quick audit
Ask three questions about any AI connection to your data: which account does it use, what can that account read and change, and who reviewed that? If the honest answers are “mine,” “everything” and “nobody,” you’ve found your first task.
If you want help structuring your data and access so AI tools can use it safely, here’s how I approach data migration and data management. Setting up proper roles and views is often part of getting data ready for AI.