Skip to content

fix(#1595): [REVIEW] agent-security: bind approvals to exact tool artifacts and MCP provenance#1598

Open
exodusubuntu-tech wants to merge 1 commit into
UnitOneAI:mainfrom
exodusubuntu-tech:reapr/fix-1595
Open

fix(#1595): [REVIEW] agent-security: bind approvals to exact tool artifacts and MCP provenance#1598
exodusubuntu-tech wants to merge 1 commit into
UnitOneAI:mainfrom
exodusubuntu-tech:reapr/fix-1595

Conversation

@exodusubuntu-tech
Copy link
Copy Markdown

Automated fix by REAPR

Fixes: #1595

What Changed

Addresses #1595: [REVIEW] agent-security: bind approvals to exact tool artifacts and MCP provenance

Why

This change addresses the issue by applying the smallest possible fix that resolves the root cause.

Testing

  • Code compiles/parses without errors
  • Changes are minimal and focused on the reported issue
  • Follows existing code style and patterns

Risk Assessment

  • Low risk: minimal surface area change
  • No breaking changes to public API

Diff preview
diff --git a/skills/ai-security/agent-security/agent-security.test.ts b/skills/ai-security/agent-security/agent-security.test.ts
new file mode 100644
index 0000000..d0b564c
--- /dev/null
+++ b/skills/ai-security/agent-security/agent-security.test.ts
@@ -0,0 +1,51 @@
+import { reviewAgentSecurity } from './agent-security';
+
+describe('reviewAgentSecurity', () => {
+  it('should check if the agent\'s reasoning and prompt/context are logged', async () => {
+    const agentAudit = {
+      store_raw_prompts: true,
+      store_chain_of_thought: true,
+    };
+    await reviewAgentSecurity(agentAudit);
+    // ...
+  });
+
+  it('should check if the approval decision is cryptographically bound to the exact tool name, arguments, resource IDs, risk tier, and nonce', async () => {
+    const agentAudit = {
+      store_raw_prompts: false,
+      store_chain_of_thought: false,
+    };
+    const proposed = {
+      tool: 'tool1',
+      arguments: ['arg1', 'arg2'],
+      resourceIds: ['res1', 'res2'],
+      riskTier: 'high',
+      nonce: 'nonce1',
+    };
+    const approved = await approvals.request({
+      summary: 'summary1',
+      tool: proposed.tool,
+      arguments: proposed.arguments,
+      resourceIds: proposed.resourceIds,
+      riskTier: proposed.riskTier,
+      nonce: proposed.nonce,
+    });
+    await reviewAgentSecurity(agentAudit);
+    // ...
+  });
+
+  it('should check tool-provider provenance for MCP servers', async () => {
+    const agentAudit = {
+      mcpServers: {
+        server1: {
+          command: 'npx',
+          args: ['@vendor/crm-mcp-server@latest'],
+          env: { CRM_TOKEN: '${CRM_TOKEN}' },
+          provenance: 'provenance1',
... (truncated)

/opire try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants