ReleaseInsight · On RadarHabr AI→ original

GateRook checks AI agent requests in 3 steps before granting infrastructure access

When an AI agent is given direct database access, a single “do not touch production” instruction is not enough. GateRook moves control out of the prompt and into a separate MCP gateway: it binds each call to a specific resource, checks policies, and blocks writes until a human makes a decision. In the example, a routine UPDATE is not executed immediately—the user first sees the exact SQL, the environment, and the expected impact.

AI-processed from Habr AI; edited by Hamidun News
GateRook checks AI agent requests in 3 steps before granting infrastructure access
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Log access is limited by file, time range, scan volume, and number of lines.
Key metric #2The saved SQL is what gets approved, so the agent cannot silently swap in another query.
Key metric #3The gateway complements database and server permissions but does not replace minimal system roles.

Giving an AI agent a terminal and a database password is a quick way to eliminate manual log copying. It is also a quick way to lose control over exactly what the agent reads or changes. A prompt instruction such as “never touch production” offers weak protection here: the model may confuse environments, misinterpret an instruction it finds, or send valid SQL to the wrong database.

GateRook proposes moving control into a separate execution layer between the AI client and the infrastructure. It is a local desktop application with an MCP gateway, connectors for databases, logs, APIs, and servers, access policies, and a unified call log. The project is available under Apache 2.0. However, the article was written by its creator, so its capability claims should be treated as a product demonstration rather than an independent security audit.

Not a terminal, but a narrowly scoped tool

Instead of unrestricted SSH, the agent receives, for example, a log-search tool. The request explicitly specifies the connection, file, search string, time range, maximum scan volume, and number of lines to return. The agent can test a hypothesis without receiving a universal command line.

This contract is more useful than a broad permission to “inspect the server.” The owner sees the actual call arguments, the SSH secret never enters the chat, and the amount of data read is capped in advance. Repeatable operations can be exposed as runbook commands with typed parameters. But the wrapper itself guarantees nothing: a dangerous command inside a runbook remains dangerous.

Resources are divided into three entities. A Connector describes how to work with MySQL, MongoDB, Redis, SSH, or another type of system. A Connection stores the settings for a specific resource and its environment. An Endpoint determines which connections and tools a given AI client can see. This makes it possible to separate dev and production behind different entry points instead of relying on the model’s attentiveness.

Why one approval is not enough

A revealing example is a SELECT statement with no database explicitly selected. The query itself is safe in terms of operation type, but the connection provides access to two databases. GateRook rejects the call before it reaches the DBMS and explains why: no database was selected. The user clicking “approve” does not override this mandatory condition.

The process is stricter for writes. The agent proposes an UPDATE, the gateway classifies it as a mutation, and a temporary approval request is created. A human sees the exact SQL, connection, environment, and impact estimate. After approval, the core checks the configuration again and executes the saved query. The agent cannot replace the already approved SQL with another expression.

This is an important architectural detail: approval is tied not to a tool name, but to the specific contents of the operation. If the user does not respond in time, the request expires. If the outcome of a write is unknown because of a timeout, the mutation must not be retried automatically—no response does not mean the database remained unchanged.

What to adopt in your own system

GateRook’s practical value is not limited to the ready-made application. It is a useful pattern for any infrastructure that admits agents: provide specialized tools instead of a shell, separate environments, reject ambiguous requests, approve an immutable payload, and log both the decision and the result.

The gateway does not replace the infrastructure’s own permissions. Production should be read through a separate account with minimal grants, while writes should be restricted at the DBMS, API, and server levels. Storing secrets locally also does not mean data never leaves the computer: results from approved requests are sent to the AI client and potentially onward to the model provider. Masking, output limits, and a clear log-retention policy are still required.

For developers, the main takeaway is simple: access control for agents must not live inside prompt text. For product teams, the approval interface should show the action and its consequences, not a generic Allow button. GateRook demonstrates this approach convincingly, although an independent review of the implementation, threat model, and claimed guarantees is still necessary.

Story

Key Questions Answered

What are the key details on Not a terminal, but a narrowly scoped tool?

Instead of unrestricted SSH, the agent receives, for example, a log-search tool. The request explicitly specifies the connection, file, search string, time range, maximum scan volume, and number of lines to return. The agent can test a hypothesis without receiving a universal command line. This contract is more useful than a broad permission to “inspect the server.” The owner sees the actual call arguments, the SSH secret never enters the chat, and the amount of data read is capped in advance.

Why one approval is not enough?

A revealing example is a SELECT statement with no database explicitly selected. The query itself is safe in terms of operation type, but the connection provides access to two databases. GateRook rejects the call before it reaches the DBMS and explains why: no database was selected. The user clicking “approve” does not override this mandatory condition. The process is stricter for writes. The agent proposes an UPDATE, the gateway classifies it as a mutation, and a temporary approval request is created.

What to adopt in your own system?

GateRook’s practical value is not limited to the ready-made application. It is a useful pattern for any infrastructure that admits agents: provide specialized tools instead of a shell, separate environments, reject ambiguous requests, approve an immutable payload, and log both the decision and the result. The gateway does not replace the infrastructure’s own permissions. Production should be read through a separate account with minimal grants, while writes should be restricted at the DBMS, API, and server levels.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…