How to Configure Cursor SQL Server Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a cursor sql server sandbox by creating a read-only database user. Then you wire that user to your AI coding agent via a database tool. Many teams start by handing the agent a broad developer login. That approach creates big risks for your data. An agent with owner rights can change rows or drop the whole database. Limiting the database role is your first line of defense. How a native cursor sql server sandbox works SQL Server uses logins and database users to manage who gets in. A

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a cursor sql server sandbox by creating a read-only database user. Then you wire that user to your AI coding agent via a database tool. Many teams start by handing the agent a broad developer login. That approach creates big risks for your data. An agent with owner rights can change rows or drop the whole database. Limiting the database role is your first line of defense.

How a native cursor sql server sandbox works

SQL Server uses logins and database users to manage who gets in. A login sits in the master database and works across many databases. A database user is the identity of that login inside one database. For a single test database, a contained database user is a good option. It uses a password and does not tie back to a login in master. An admin must first turn on contained databases on the server and database.

Once you create the user, you assign it to fixed database roles. You cannot change the permissions inside these fixed roles. The data reader role lets the user read all user tables and views. The data writer role lets a user add, change, or delete table data. You can also add the deny data writer role to block all writes. Every role, including the public role, holds the basic permission to connect. By combining the reader role with the deny writer role, you block changes.

How AI coding agents run database queries

AI coding agents reach databases through Model Context Protocol servers or shell commands. An MCP server connects the agent to external tools, databases, and APIs. You give the MCP server a database string that holds your read-only user. You should always verify that you trust an MCP server before you use it. Agents can also run database tools from a shell command if you approve it.

This setup gives the agent a way to inspect schemas and test queries. Still, a local file still holds the database password in plain text. Anyone or any process on the workstation can read that file and log in. Also, the database user role applies the same rules to every single query.

Kubernetes API Server Access + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native roles solve and what they miss

Fixed database roles do a great job of stopping bad writes. If an agent tries to delete a table, the deny writer role stops it. It also blocks the agent from dropping the database like an owner could. This protects the structure and state of your sandbox tables during tests.

Still, database roles only check who logs in at the start. They do not inspect what individual queries do while they run in flight. A member of the data reader role can read every single user table. If your sandbox holds real emails, phone numbers, or card numbers, queries return them. A native reader role cannot mask sensitive fields or require approval for specific queries. It also cannot hide the raw database password from the local client config.

Govern SQL Server queries and responses in flight

Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.

With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.

Frequently asked questions

Should I use a standard login or a contained user for a sandbox?

Use a contained user if the agent only needs one or a few databases. It stays inside the target database and does not need a master login. An admin just needs to turn on contained databases on the server first.

Does the read-only role hide sensitive columns in a test database?

No, the fixed data reader role lets the user read all user tables. If your sandbox has real emails or card numbers, the agent gets them. Native roles cannot rewrite matched fields in query results on the fly.

Can I edit the permissions of the built-in SQL Server reader role?

No, SQL Server does not let you change permissions on fixed database roles. To block specific tables, you must create custom roles or use deny roles. Even then, native roles only control table access and cannot filter live payloads.

The query runs. The emails stay hidden.