How to Configure Windsurf SQL Server Permissions

Published
Length
4 min read

Luis Felipe Dias

All posts

To set up windsurf sql server permissions, create a dedicated database user with read-only roles. Then link that account to the coding agent through its terminal or tool settings. Many teams start by giving their AI coding assistant an existing developer login. That shortcut creates high risk when an automated tool shares broad rights with a human user. If a prompt goes wrong, an overprivileged account can change or delete critical tables in seconds. How windsurf sql server permissions work C

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 permissions, create a dedicated database user with read-only roles. Then link that account to the coding agent through its terminal or tool settings. Many teams start by giving their AI coding assistant an existing developer login. That shortcut creates high risk when an automated tool shares broad rights with a human user. If a prompt goes wrong, an overprivileged account can change or delete critical tables in seconds.

How windsurf sql server permissions work

Cognition renamed Windsurf to Devin Desktop in June 2026, while keeping the same IDE features. Its Cascade agent can run terminal commands on its own after a user gives permission. Those commands run inside a dedicated terminal that uses zsh on macOS or bash on Linux. Because this terminal loads the user shell profile, local aliases and variables are ready to use. The agent can also reach external databases through Model Context Protocol servers defined in local settings.

On the database side, SQL Server separates server logins from individual database users. A database user is the identity that a login takes when it enters a specific database. When an agent needs access across many databases, admins often create a login in master first. For access to one or a few databases, a contained database user is another good option. A contained user holds its own password and does not tie back to a master login. An admin must enable contained databases on the server and the target database before using this option.

Once the user exists, admins assign fixed database roles to control what the agent can do. Every role in the database, including the public role, holds the basic right to connect. Adding a user to the data reader role lets it read all user tables and views. Adding the data writer role allows the user to add, change, or delete rows in tables. Admins can also combine roles with deny roles to block reads or writes across all user tables. By contrast, the database owner role can run any maintenance task and even drop the whole database. Because you cannot change the built-in rights of fixed roles, picking the right role matters.

Choosing between server logins and contained users

Your choice of user type shapes how you manage secrets on each developer machine. SQL Server offers thirteen distinct types of database users to match different identity setups. A traditional SQL login in master works well when an agent inspects schemas across several linked databases. Still, a login in master makes it easier to grant rights in the wrong database by mistake.

A contained user keeps the account boundary tight around a single database. If the password on a developer laptop leaks, the attacker cannot jump to other databases on that server. Teams should store that password carefully because the agent shell loads local variables into every terminal session. Keeping the agent on a separate account from the human developer also makes database logs clearer.

Kubernetes API Server Access + AI Agent Permissions: 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 do a great job of setting a hard ceiling at login time. Putting the coding agent in a read-only role stops accidental table drops and bad data updates. Deny writer roles add a second safety net if a user belongs to multiple database groups. These controls verify who can log in and which broad actions that account may run.

Still, database roles only check permissions at the table or view level once a session starts. A member of the standard data reader role can read every column in every user table by default. That means an agent query can pull emails, phone numbers, card numbers, or national IDs into prompts. Native roles also cannot judge whether a specific statement is safe in the moment it runs. An agent with write access for local testing can wipe a whole table with one bad command. Even a read-only user can run a heavy join that locks up CPU and slows production apps. Static database roles decide who gets in, not what each query does in flight.

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 give an AI coding agent the db_owner role in SQL Server?

No, you should never assign the database owner role to an automated coding agent. That role can run all maintenance tasks and can drop the entire database if a command fails. Start with the data reader role and grant narrow write rights only when needed.

How does Devin Desktop or Windsurf pass database credentials to tools?

The agent runs commands in a dedicated shell that loads your local zsh or bash settings. Any database keys stored in your shell profile become available to terminal commands and MCP servers. Use a separate low-privilege database user so the agent does not use your personal admin login.

Can fixed database roles hide sensitive columns like emails or card numbers?

No, the built-in data reader role grants read access to all user tables and views at once. You cannot change the permissions inside a fixed database role to hide specific columns. To protect emails, phone numbers, or card numbers, you need field-level masking rewriting results in flight.

The query runs. The emails stay hidden.