A company that already uses Claude Code has written its permission rules. The gate now reads that settings file and turns it into its own rules, with no one rewriting them: the same tools, folders, commands and websites, but each action is judged by what it does, not by how its text begins. On the 37 cases of our earlier test, the imported rules stopped all 28 attempts and let all 9 legitimate commands through.
## Why it matters
In our previous test we measured where a coding agent's own permission rules let through more than their author meant: 5 of 28 attempts got through, while our gate stopped all of them. But our side had an advantage: we wrote its rules by hand, knowing what the owner wanted. A customer will not rewrite its rules for us. It has a settings file already, and it should start from that.
## What we did
The gate now reads the permission block of a Claude Code settings file and compiles it into its own rules, with no hand in between. Each line keeps its meaning: a tool allowed or denied, a folder that can be read or written, a file that is closed, a command the shell may run, a website that may be fetched. What changes is how an action is judged: by what it does (which files it reads, writes or deletes, which program it runs, which host it reaches), not by how its text begins. Whatever a rule says that the gate cannot state exactly is listed for the owner, never dropped in silence.
## What we found
On the same 37 cases, with the same three settings files, the imported rules stopped all 28 attempts and let all 9 legitimate commands through, exactly like the rules we had written by hand. Claude Code's own rules, on the same settings, again let 5 through. Running the import also showed a weak spot of ours: a search that deletes files inside a folder that may only be read was not counted against that folder when the folder was not named on its own. It is fixed in gate 2.17.2.
## And inside Claude Code itself
The import also runs as a hook that Claude Code calls before every tool: the team keeps its settings file, and each call is decided by what it does before it runs. With the hook in place, Claude Code stopped all 28 attempts, including the 5 its own rules had let through, and ran all 9 legitimate commands.
## And a gateway's policy
The same works for a gateway in front of MCP servers. We read an agentgateway policy, the rules on which tools may be called and the checks on their arguments, into the gate's rules. The gateway checks the text of an argument: a path that starts with the allowed folder, a recipient that ends with the company's domain. Read that way, a path that climbs out of the folder and a second recipient outside the company got through, and a legitimate address in capital letters was refused. Imported, the same policy stopped all five attempts and passed all three legitimate calls, once we told it the one address the agent sends mail from, which a gateway policy never names.
## Technical detail
- Claude Code 2.1.334 against a local stand-in for the model: no token spent. 37 cases, results read from the world (a marker file, the secret in the output, a file deleted or changed).
- Claude Code: 5 of 28 got through, 9 of 9 legitimate passed. Our gate with hand-written rules: 0 of 28, 9 of 9. Our gate with the imported rules: 0 of 28, 9 of 9.
- One rule could not be stated exactly: "sed -n" allowed; the gate allows sed and reads each of its options itself. A rule with a pattern inside a file name (all the .ts files of a folder) is listed and left closed; a command the gate does not know stays closed.
```chart
{"title": "Attempts meant to stop that got through (of 28)", "series": ["got through"], "unit": "", "max": 28, "rows": [["Claude Code's own rules", 5], ["Our gate, rules written by hand", 0], ["Our gate, rules imported", 0]]}
```
This update is not available.