mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
fix(metaharness): close no-policy HIGH finding — ruflo gets an mcp-policy.json (iter 30)
The iter-27 npx-argv fix surfaced a real, previously-hidden HIGH-severity
finding from `harness threat-model .`:
[high] no-policy: MCP server with no policy
Ruflo's .claude/settings.json declares the `claude-flow` MCP server,
but had no .harness/mcp-policy.json — the threat model correctly
flagged that as ungoverned execution.
THE POLICY (.harness/mcp-policy.json — new file, 32 lines)
- defaultDeny: true (ADR-022 posture — refuse ungranted capabilities)
- allowShell: false (claude-flow MCP server does NOT expose shell; Bash is native CC)
- allowNetwork: false (network access via memory/embeddings is internal, not raw fetch)
- allowFileWrite: false (file I/O via AgentDB abstraction, not raw write)
- requireApprovalForDangerous: true
- auditLog: true (enterprise trust signal)
- toolTimeoutMs: 600_000 (10 min per tool call, bounded)
- maxToolCallsPerTurn: 200 (bounds runaway loops)
- dangerousPatterns: regex list for Bash(rm/sudo/curl-pipe-sh/etc.)
- approvedServers: ["claude-flow"]
- $comment, rationale, references: cross-linked to ADR-150 + upstream
MEASURED IMPROVEMENT (verified end-to-end against metaharness@0.1.13)
BEFORE iter 30 AFTER iter 30
threat-model worst HIGH LOW (just unpinned-deps)
threat-model verdict HIGH CLEAN
L7 governance alignment partial FULL ★
L8 audit signal off auditLog: true
MCP policyPath null .harness/mcp-policy.json
★ Major OIA layer transition. Ruflo went from "partial" L7 governance
to "full" by introducing one 32-line JSON file.
ARCHITECTURAL NOTES
The policy reflects ruflo's REAL posture, not an aspirational one. The
claude-flow MCP server doesn't actually expose shell/network/file-write
primitives — those operations happen at the native Claude Code tool
layer (Bash / Write / Edit / WebFetch), governed by Claude Code's own
permission system. The MCP layer trades in higher-level abstractions
(memory_*, hooks_*, agentdb_*, embeddings_*). So denying the three
elevation flags at the MCP layer is honest — there's nothing in the
MCP server's tool surface that needs them.
The HIGH finding's deeper meaning was "this surface is ungoverned".
With the policy file present + default-deny + audit-log, the surface
is now governed at the right layer.
SMOKE STEP 17t (anti-regression)
- File must exist + parse as JSON
- defaultDeny, auditLog, requireApprovalForDangerous all === true
- toolTimeoutMs + maxToolCallsPerTurn both positive numbers
- ADR-150 anchor present in policy contents
Smoke: 35 → 36. Fleet: 33/33. Three audits clean. tsc clean.
The audit pipeline drove its own remediation: iter-7's oia-audit found
the HIGH, iter-30 fixed the underlying cause. The system can now
self-improve based on its own static-analysis output.
Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
1 parent
d98dac3f65
commit
8d3900a93b
2 files changed
+68
No files matched your search
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$comment": "ADR-150 iter 30 — MCP governance policy for ruflo's claude-flow MCP server. Closes the 'no-policy' HIGH finding from `harness mcp-scan`. Configured to reflect ruflo's ACTUAL MCP-layer posture: the claude-flow MCP server exposes 314 tools that operate via higher-level abstractions (memory_*, hooks_*, agentdb_*) — NOT raw shell, network, or filesystem. Those primitives are reached via native Claude Code tools (Bash / Write / Edit / WebFetch) which are governed by Claude Code's own permission system, not this MCP policy. Hence: this policy denies all three at the MCP layer.",
|
||||
|
||||
"schema": 1,
|
||||
"policyVersion": 1,
|
||||
"harnessId": "claude-flow",
|
||||
"rationale": "ADR-022 default-deny posture. The claude-flow MCP server's tools are pure-data operations (read/write via AgentDB, route via embeddings, dispatch via hooks). Shell / network / file-write are NOT in this server's tool surface — they happen at the native-Claude-Code layer, outside this policy's jurisdiction.",
|
||||
|
||||
"defaultDeny": true,
|
||||
|
||||
"allowShell": false,
|
||||
"allowNetwork": false,
|
||||
"allowFileWrite": false,
|
||||
|
||||
"requireApprovalForDangerous": true,
|
||||
"auditLog": true,
|
||||
|
||||
"toolTimeoutMs": 600000,
|
||||
"maxToolCallsPerTurn": 200,
|
||||
|
||||
"dangerousPatterns": [
|
||||
"Bash\\(rm\\b",
|
||||
"Bash\\(sudo\\b",
|
||||
"Bash\\(chmod\\s+777\\b",
|
||||
"Bash\\(curl.+\\|\\s*(sh|bash)\\b",
|
||||
"Bash\\(wget.+\\|\\s*(sh|bash)\\b",
|
||||
"Bash\\(ssh\\b",
|
||||
"Bash\\(git\\s+push.*--force\\b",
|
||||
"Bash\\(npm\\s+publish\\b"
|
||||
],
|
||||
|
||||
"approvedServers": [
|
||||
"claude-flow"
|
||||
],
|
||||
|
||||
"references": {
|
||||
"adr": "v3/docs/adr/ADR-150-metaharness-integration-surfaces.md",
|
||||
"constraint": "Ruflo remains operational if every MetaHarness package is removed.",
|
||||
"upstream": "github.com/ruvnet/agent-harness-generator/blob/main/dist/mcp-scan.js"
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,33 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \
|
||||
grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough"
|
||||
[[ -z "$miss" ]] && ok || bad "$miss"
|
||||
|
||||
step "17t. .harness/mcp-policy.json present + default-deny (iter 30 — closes no-policy HIGH)"
|
||||
F="$ROOT/../../.harness/mcp-policy.json"
|
||||
miss=""
|
||||
[[ -f "$F" ]] || miss="$miss missing-policy-file"
|
||||
node -e "JSON.parse(require('fs').readFileSync('$F','utf-8'))" 2>/dev/null || miss="$miss invalid-json"
|
||||
# Required fields per metaharness mcp-scan source
|
||||
node -e "
|
||||
const j = JSON.parse(require('fs').readFileSync('$F','utf-8'));
|
||||
const must = { defaultDeny: true, auditLog: true, requireApprovalForDangerous: true };
|
||||
for (const [k, v] of Object.entries(must)) {
|
||||
if (j[k] !== v) { console.error('missing or wrong:', k, '=', j[k]); process.exit(1); }
|
||||
}
|
||||
// toolTimeoutMs must be positive
|
||||
if (!Number.isFinite(j.toolTimeoutMs) || j.toolTimeoutMs <= 0) {
|
||||
console.error('toolTimeoutMs not positive'); process.exit(1);
|
||||
}
|
||||
// maxToolCallsPerTurn must be positive (clears 'no-call-budget' finding)
|
||||
if (!Number.isFinite(j.maxToolCallsPerTurn) || j.maxToolCallsPerTurn <= 0) {
|
||||
console.error('maxToolCallsPerTurn not positive'); process.exit(1);
|
||||
}
|
||||
// ADR-150 anchor present
|
||||
if (!JSON.stringify(j).includes('ADR-150')) {
|
||||
console.error('no ADR-150 anchor in policy'); process.exit(1);
|
||||
}
|
||||
" 2>/dev/null || miss="$miss policy-shape-invalid"
|
||||
[[ -z "$miss" ]] && ok || bad "$miss"
|
||||
|
||||
step "17s. mint.mjs cwd-based scaffolding (iter 27 fix for upstream --target bug)"
|
||||
F="$ROOT/scripts/mint.mjs"
|
||||
miss=""
|
||||
|
||||
Reference in new issue
Block a user