|
63 | 63 | PASS=$((PASS + 1)) |
64 | 64 | fi |
65 | 65 |
|
| 66 | +# ── Case 3: an .mcpb bundle manifest must not be audited as a compiled binary ── |
| 67 | +# `file` reports JSON as "JSON data", which matched none of the text patterns, so |
| 68 | +# the manifest was run through the URL audit and its own homepage/documentation |
| 69 | +# fields were BLOCKED as unauthorized. This blocked the v0.10.3 release — the |
| 70 | +# first release to ship .mcpb bundles, hence the first time a manifest reached |
| 71 | +# the scanned object set. |
| 72 | +MANIFEST="$TMP/manifest.json" |
| 73 | +cat > "$MANIFEST" <<'JSON' |
| 74 | +{ |
| 75 | + "name": "codebase-memory-mcp", |
| 76 | + "homepage": "https://github.com/DeusData/codebase-memory-mcp", |
| 77 | + "documentation": "https://deusdata.github.io/codebase-memory-mcp/", |
| 78 | + "server": { "command": "codebase-memory-mcp", "args": [] } |
| 79 | +} |
| 80 | +JSON |
| 81 | +if bash "$SCRIPT" "$MANIFEST" >/dev/null 2>&1; then |
| 82 | + echo "PASS: .mcpb manifest.json audited as structured text, not as a binary" |
| 83 | + PASS=$((PASS + 1)) |
| 84 | +else |
| 85 | + echo "FAIL: manifest.json still audited as a compiled binary (regression)" |
| 86 | + bash "$SCRIPT" "$MANIFEST" 2>&1 | grep -i "BLOCKED" || true |
| 87 | + FAIL=$((FAIL + 1)) |
| 88 | +fi |
| 89 | + |
| 90 | +# ── Case 4 (negative control for case 3): the exemption is by FILE TYPE, not a |
| 91 | +# blanket pass. A binary carrying an unauthorized URL must still be blocked even |
| 92 | +# though a .json carrying one would not be — that asymmetry is the design, and |
| 93 | +# case 2 above proves the binary half still holds. Here we prove the credential |
| 94 | +# audit still runs on structured text, so the exemption is narrow. ── |
| 95 | +CREDS="$TMP/creds.json" |
| 96 | +# The credential audit matches assignment syntax (api_key=, secret=, ...), which |
| 97 | +# is what leaks look like in embedded strings — so the fixture uses that form |
| 98 | +# inside the JSON value rather than a JSON "key": "value" pair. |
| 99 | +printf '{"connection":"host=db user=admin password=hunter2-not-a-real-secret"}' > "$CREDS" |
| 100 | +if bash "$SCRIPT" "$CREDS" >/dev/null 2>&1; then |
| 101 | + echo "FAIL: credential pattern in JSON was NOT flagged (exemption too broad)" |
| 102 | + FAIL=$((FAIL + 1)) |
| 103 | +else |
| 104 | + echo "PASS: credential audit still runs on structured text" |
| 105 | + PASS=$((PASS + 1)) |
| 106 | +fi |
| 107 | + |
66 | 108 | echo "=== security-strings allow-list test: $PASS passed, $FAIL failed ===" |
67 | 109 | [ "$FAIL" -eq 0 ] |
0 commit comments