How to Configure Windsurf SQL Server Audit Log
You set up a windsurf sql server audit log by pairing dedicated database users with native server logging. This setup tracks every query that the AI coding agent runs during a coding session. Teams often share personal database accounts with their coding tools to move fast. Broad roles let an agent change tables, drop databases, or read private records without clear tracking. How a windsurf sql server audit log works with agent permissions Cognition renamed Windsurf to Devin Desktop in June 2
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 windsurf sql server audit log by pairing dedicated database users with native server logging. This setup tracks every query that the AI coding agent runs during a coding session. Teams often share personal database accounts with their coding tools to move fast. Broad roles let an agent change tables, drop databases, or read private records without clear tracking.
How a windsurf sql server audit log works with agent permissions
Cognition renamed Windsurf to Devin Desktop in June 2026, keeping the same IDE features. Its agent runs terminal commands on its own after the user gives permission. It uses a dedicated shell that loads the local shell setup, aliases, and variables. The legacy Cascade agent also talks to external databases through Model Context Protocol servers.
When the agent runs a query, SQL Server checks its database login and user identity. A database user maps a server login to a specific database. Admins can create a standard login in the master database for multi-database work. They can also create a contained database user with its own password for one database. An admin must enable contained databases on the server and database first.
To keep the audit log clean, give the agent its own database user. Next, assign that user to a fixed database role. The data reader role lets the user read all data from all user tables and views. The deny data writer role stops the user from adding, changing, or deleting data. Do not use the database owner role, because it allows full maintenance and dropping the database. Fixed database roles cannot have their built-in permissions changed.
What native database roles solve and what they miss
Native roles and server logs solve the basic problem of who logged into the database. When the agent has a dedicated login, the server log records that specific identity. Security teams can review the log later to see when the agent ran queries. Pairing the data reader role with the deny data writer role blocks table changes.
Still, native setup only checks who logs in and which tables they can read. It does not inspect or filter what individual statements do while they run in flight. A user in the data reader role can still read every row in every user table by default. If a table holds emails, phone numbers, card numbers, or national IDs, the agent reads them. Those raw values then enter the agent prompt context and local terminal history.
Audit Log Integrity + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why local shell variables complicate database auditing
Because the agent terminal loads the user shell setup, it inherits local variables and aliases. If a developer stores personal database keys in their shell profile, the agent can use them. Every query from the agent then looks like it came from the human developer. You lose the clean separation between human actions and automated agent actions in the log.
Static passwords stored on developer laptops also create rotation tasks for the security team. If a laptop is lost, admins must reset the database user password across many machines. Native roles also cannot pause a single risky query for human review before it runs. Relying only on static roles leaves sensitive columns open to full table reads.
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
How do I separate Windsurf agent queries from human queries in SQL Server logs?
Create a dedicated SQL Server login or contained database user just for the coding agent. Do not let the agent use the human developer credentials from the local shell profile.
Which SQL Server role should I give an AI coding agent for read-only work?
Assign the agent user to the fixed data reader role and the deny data writer role. Note that the data reader role still reads all user tables, including sensitive columns.
Can SQL Server fixed database roles hide sensitive columns like emails or card numbers?
No, you cannot change the permissions inside fixed database roles like the data reader role. Members of that role can read all data across all user tables and views.
Related guides
In this post