How to Configure Windsurf SQL Server Guardrails
You set up windsurf sql server guardrails by combining database roles with statement controls. First, create a restricted database user so the coding agent only reads allowed tables. Many teams connect their AI editor using a personal admin login to save time. When an agent runs with broad permissions, one bad prompt can delete production rows. It can also pull sensitive customer fields into the local chat window. How to set up native windsurf sql server guardrails On June 2, 2026, Cognition
Kubernetes API Server Access + AI Guardrails: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up windsurf sql server guardrails by combining database roles with statement controls. First, create a restricted database user so the coding agent only reads allowed tables. Many teams connect their AI editor using a personal admin login to save time. When an agent runs with broad permissions, one bad prompt can delete production rows. It can also pull sensitive customer fields into the local chat window.
How to set up native windsurf sql server guardrails
On June 2, 2026, Cognition renamed the Windsurf editor to Devin Desktop. The editor keeps the same features and uses its agent to run terminal commands. When a developer gives permission, the agent runs commands in a dedicated shell. It uses zsh on macOS and bash on Linux. That shell loads the local user profile, including shell aliases and stored variables. The legacy Cascade agent also talks to external tools through Model Context Protocol servers.
Because the agent inherits your local shell variables, it can use your database credentials. To limit what the agent can do, start inside SQL Server. First, decide how the agent should log in to the database engine. A database user is the identity of a login inside a specific database. If the agent needs several databases on one server, create a login in master. Then map a database user to that login.
If the agent only needs one database, you can use a contained database user. This user has a password and does not tie to a login in master. An admin must enable contained databases on the server and target database first. SQL Server offers 13 types of database users for different needs.
Next, assign the user to a fixed database role. Fixed role permissions cannot be changed. Adding the user to the datareader role lets it read all user tables. It can also read all views. To block writes for good, add the user to the denydatawriter role. Members of that role cannot add, change, or delete any table data. Never assign the owner role to an agent login. That role can change server settings and drop the entire database.
Why native roles are only half of the setup
Database roles control who can log in and which tables they can read. They do not inspect what individual queries do while running. A user in the datareader role can still read every row in every table by default. If a table holds emails, phone numbers, or card numbers, the agent gets them. Those raw values flow straight into the model context.
Kubernetes API Server Access + AI Guardrails: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Fixed roles also apply to the whole database at once. If you want to hide one table, the standard datareader role is too broad. You can add the user to denydatareader, which blocks all user tables and views. Otherwise, you have to manage custom grants on each table by hand.
Even when you give an agent write permissions for testing, roles stay blunt. A member of the datawriter role can add, change, or delete rows anywhere. Native roles cannot pause a risky delete command to ask for human approval. They also cannot rewrite query results on the fly to mask national IDs.
What to check before letting an agent query data
Before you let an editor agent run SQL, check your local shell profile. Remove admin database passwords from your shell config files so the agent cannot read them. Create a separate SQL Server user just for the coding agent. Give that user the smallest role needed for the task. Keep write roles off by default. Finally, plan how you will filter sensitive columns and review write statements before execution.
Check SQL Server batches and results on the wire
SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Windsurf run SQL queries on its own?
Yes, the editor agent can run terminal commands once the user grants permission. Because its shell loads your profile, it can run database tools using your credentials. It can also query databases through configured Model Context Protocol servers.
Does the SQL Server datareader role hide sensitive columns?
No, members of the fixed datareader role can read all data from all user tables. The role does not hide or mask emails, phone numbers, or card numbers. You need separate column controls or data masking to protect those fields.
How do I stop an agent from changing data in SQL Server?
Create a dedicated database user for the agent and avoid the datawriter and owner roles. Add the user to the datareader role for read access. You can also add the denydatawriter role to block any adds, updates, or deletes.
Related guides
In this post