How to Configure Windsurf SQL Server Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up windsurf sql server least privilege, give the coding agent a dedicated read-only database user. Then restrict that user to only the tables the agent needs to read. Teams often start by handing an agent a shared admin account to speed up local work. If an agent uses a broad role, one bad query can change or drop tables. How windsurf sql server least privilege works in practice Cognition renamed Windsurf to Devin Desktop in June 2026, keeping the same IDE features. Its agent can run t

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.

To set up windsurf sql server least privilege, give the coding agent a dedicated read-only database user. Then restrict that user to only the tables the agent needs to read. Teams often start by handing an agent a shared admin account to speed up local work. If an agent uses a broad role, one bad query can change or drop tables.

How windsurf sql server least privilege works in practice

Cognition renamed Windsurf to Devin Desktop in June 2026, keeping the same IDE features. Its agent can run terminal commands in a dedicated shell with user permission. That shell loads the local profile, so the agent can use shell variables and aliases. The legacy Cascade agent also reaches outside tools through local Model Context Protocol servers. When the agent queries a database, it uses the login details stored on your machine.

In SQL Server, a login in the master database maps to a database user. If the agent needs many databases on one server, teams create a login in master. If the agent needs one or a few databases, a contained database user works well. A contained user has a password inside the target database and skips the master login. An admin must turn on contained databases on the server and database first. SQL Server supports thirteen types of database users in total.

How to scope SQL Server roles for AI coding agents

Once you create the user, you must assign permissions inside the database. Many teams add the user to a fixed database role to save time. Every role, including the public role, has permission to connect to the database. You cannot change the permissions built into fixed database roles.

The fixed owner role can run all maintenance tasks and can even drop the database. Never give that owner role to an automated coding agent. Instead, the fixed data reader role lets the user read all user tables and views. The fixed data writer role lets the user add, change, or delete table data. You can also use deny roles to block reading or writing across the database.

Even the fixed data reader role is often too broad for an AI agent. It lets the agent read every user table, including tables with sensitive customer fields. To follow least privilege, skip the fixed data reader role when sensitive tables exist. Create a custom role and grant read access only to specific tables or views. You can also add the user to the deny data writer role as a safeguard.

Least Privilege Principle + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native SQL Server roles control who can log in and which objects they can touch. A well-scoped user stops an agent from dropping tables or modifying production rows. It also blocks the agent from reading schemas outside its assigned scope.

Still, static database roles only check permissions when a session starts or a query runs. They do not inspect what individual statements do in flight or hide sensitive columns. If an agent has read access to a customer table, it pulls every column. Raw emails, phone numbers, and card numbers flow straight into the agent context window. Static credentials also sit in local shell files where any terminal command can read them. Native roles cannot require human approval for a single risky query or mask data dynamically.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

Should I give the Windsurf agent the fixed data reader role?

Only use the fixed data reader role if every table in the database is safe. That role grants read access to all user tables and views in the database. For stricter control, grant select permissions only on the specific tables the agent needs.

When should I use a contained database user in SQL Server?

Use a contained database user when the agent only needs one or a few databases. It keeps user setup inside the target database instead of the master database. Remember that an admin must enable contained databases on the server and database first.

Why are static read-only roles not enough for AI coding agents?

Read-only roles stop data changes, but they do not filter the results of a query. An agent can still read emails, phone numbers, or card numbers from allowed tables. You also need a way to rewrite matched fields in results and audit every query.

The query runs. The emails stay hidden.