Skip to content

docs: reconcile rulebook with the 102-rule pack and index the mcp family#3

Merged
jhumel-code merged 3 commits into
mainfrom
docs/reconcile-mcp-pack
Jun 4, 2026
Merged

docs: reconcile rulebook with the 102-rule pack and index the mcp family#3
jhumel-code merged 3 commits into
mainfrom
docs/reconcile-mcp-pack

Conversation

@jhumel-code

@jhumel-code jhumel-code commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Catches the rulebook up to the current 102-rule pack (which now includes the 14-rule mcp/ pack) on every axis: the generated indexes, the totals, and the per-rule rationale docs. CI is green.

Commit 1 — index the mcp family + fix stale totals

  • tools/gen_index.py — added the mcp family to SDK_ORDER / SDK_LABEL / SDK_FULL. Without it the generator omitted all MCP rules from the index.
  • POLICY_INDEX.md (master + per-SDK) + new mcp/POLICY_INDEX.md — regenerated from the pack. gen_index.py --check now passes (102 rules); it was failing on 4 stale index files.
  • README.md — the "Current totals" table was badly stale (~43 rules). Reconciled to the real counts.
  • docs/policy-rationale-doc-template-guide.md — fixed broken example paths in the guide.

Commit 2 — rationale docs for all 14 MCP rules

The consistency gate (check_rulebook.py --strict) requires a rationale doc for every shipped rule; the mcp/ pack had none, so CI was red on 14 coverage errors. Added docs/Policy/mcp/{tool_definition,network,path_safety,error_handling,idempotency,ssrf,code_execution,shell_safety}.md (8 docs covering MCP-001..014).

  • Each is modeled on the existing same-topic doc in the claude_sdk / openai_sdk / google_adk chapters, so the OWASP references, fix_type, and threat-model structure are grounded in already-reviewed precedent rather than invented.
  • Front-matter severity/confidence/scope is copied verbatim from the pack (the gate checks to 1e-9).
  • The prose is grounded in the actual rule predicates read from the engine (has_code_exec_call, code_exec fact in ts_handler_facts.go, the HTTP-callee sets in heuristics.go/ts_handler_facts.go), including the MCP-specific trust-boundary framing (model-controlled inputs from an external orchestrator, no human in the loop, server shared across clients).

Result

  • check_rulebook.py --strictOK (102 rules, 45 docs, 0 errors).
  • gen_index.py --checkOK (102 rules).
  • Build-PDF job → green.
  • This closes the standing rulebook coverage gap — every shipped rule now has a rationale doc.

Reviewer notes

  • Includes a 3-line change to tools/gen_index.py (the index generator); the regenerated POLICY_INDEX.md files are its output.
  • The indexes were regenerated in a Python 3.12 env to match CI (the gen_index.py write path needs 3.10+; the machine default is 3.9 — a latent tooling nit, noted but not fixed here).

The pack grew to 102 rules across 45 files (incl. the new 14-rule mcp
pack), but the rulebook totals were stale and its generated indexes
omitted mcp entirely.

- tools/gen_index.py: add the mcp family to SDK_ORDER/SDK_LABEL/SDK_FULL
  so MCP rules are projected into the index instead of silently dropped.
- Regenerate POLICY_INDEX.md (master + per-SDK) and add
  mcp/POLICY_INDEX.md; gen_index.py --check now passes at 102 rules.
- README.md: correct the stale "Current totals" table to 102 shipped /
  88 documented, with an honest note on the 14 undocumented MCP rules.
- docs/policy-rationale-doc-template-guide.md: fix broken example paths.

Authoring the 14 MCP rationale docs (MCP-001..014) remains the standing
gap and is intentionally out of scope here.
The consistency gate (check_rulebook.py --strict) requires a rationale doc
for every shipped rule; the mcp/ pack (MCP-001..014) had none, so CI was
red on 14 coverage errors.

Add docs/Policy/mcp/{tool_definition,network,path_safety,error_handling,
idempotency,ssrf,code_execution,shell_safety}.md, each modeled on the
existing same-topic docs in the other SDK chapters and framed for the MCP
trust boundary (model-controlled inputs from an external orchestrator, no
human in the loop, server shared across clients). Front-matter
severity/confidence/scope copied verbatim from the pack.

check_rulebook.py --strict and gen_index.py --check both pass (102 rules,
45 docs).
PR #2 (feat/mcp-rationale-docs) added the MCP rationale docs to main
concurrently with this branch. Resolved the 8 docs/Policy/mcp/*.md add/add
conflicts in favor of main's already-merged versions.

This branch retains its unique contribution, which PR #2 did not include:
the tools/gen_index.py `mcp` family fix, the regenerated indexes (master +
per-SDK + new mcp/POLICY_INDEX.md), the README totals, and the
template-guide path fixes. Without the gen_index fix, main's index silently
omits all 14 MCP rules.

Both gates green: check_rulebook.py --strict and gen_index.py --check.
@jhumel-code jhumel-code merged commit f69ebb0 into main Jun 4, 2026
2 checks passed
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.

1 participant