Skip to content

Commit a939cfc

Browse files
fix: deny codex exec_command with index mcp (#1510)
Closes #1508 ## Summary - deny Codex `exec_command` alongside `Bash` when the index MCP server is configured - update the policy assertion to cover both shell tool surfaces ## Validation - `nix eval --impure --json --expr 'let lib = (import <nixpkgs> {}).lib; policy = import ./packages/agent/policy/permissions.nix { inherit lib; mcpServers.index = {}; }; in policy.codex.deniedToolPatterns'` - `nix fmt -- --check packages/agent/policy/permissions.nix tests/default.nix` - `git diff --check` (sent by an AI agent via Claude Code) <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Deny `exec_command` alongside `Bash` when the index MCP server is present > In [permissions.nix](https://github.com/indexable-inc/index/pull/1510/files#diff-c9733b1461e1c4084b3b81090b51274bf4a156b58a7110dfb75a5d40bef2df1d), `exec_command` is added to `supersededCodexTools` alongside `Bash` when the `index` MCP server is present, so both shell tools are denied. The corresponding test in [tests/default.nix](https://github.com/indexable-inc/index/pull/1510/files#diff-1cc580de297308d93d82f7b72446ae4b98832a8aae3378e9e134102519a0e33a) is updated to assert `deniedToolPatterns` contains both `"Bash"` and `"exec_command"`. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 8eff44f.</sup> > <!-- Macroscope's review summary ends here --> > <!-- macroscope-ui-refresh --> <!-- Macroscope's pull request summary ends here -->
1 parent bf9811a commit a939cfc

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/agent/policy/permissions.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ let
1515
]
1616
++ lib.optional (mcpServers ? index) "Bash";
1717

18-
supersededCodexTools = lib.optional (mcpServers ? index) "Bash";
18+
supersededCodexTools = lib.optionals (mcpServers ? index) [
19+
"Bash"
20+
"exec_command"
21+
];
1922
in
2023
{
2124
claude = {

tests/default.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,8 +3392,11 @@ let
33923392
mcpServers.index = { };
33933393
};
33943394
in
3395-
policy.codex.deniedToolPatterns == [ "Bash" ];
3396-
message = "Codex should deny the Bash tool when the index MCP is available";
3395+
policy.codex.deniedToolPatterns == [
3396+
"Bash"
3397+
"exec_command"
3398+
];
3399+
message = "Codex should deny shell tools when the index MCP is available";
33973400
}
33983401
{
33993402
# Bypass-permissions is enforced through Claude's managed-settings layer

0 commit comments

Comments
 (0)