Skip to content

docs(mcp): add defense-in-depth paragraph and assertion test#150

Merged
toasterbook88 merged 2 commits into
mainfrom
chore/mcp-defense-in-depth-doc
Jun 2, 2026
Merged

docs(mcp): add defense-in-depth paragraph and assertion test#150
toasterbook88 merged 2 commits into
mainfrom
chore/mcp-defense-in-depth-doc

Conversation

@toasterbook88
Copy link
Copy Markdown
Owner

Adds a 'Defense in depth' section to the MCP package doc that makes the safety boundary explicit: client-supplied tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) are advisory metadata and cannot weaken the safety blocker or execution layer. Adds a test that reads doc.go and asserts the required phrases are present so the contract cannot be silently reworded away.

Why now: The MCP-2025-06-18 spec defines ToolAnnotation hints. AXIS MCP tools are already read-only by design and 10 of them are registered with WithReadOnlyHintAnnotation(true) (internal/mcp/server.go). The remaining gap was that nothing in the public docs stated the safety boundary in writing.

Files:

  • internal/mcp/doc.go — adds the 'Defense in depth' paragraph
  • internal/mcp/doc_test.go — new test, reads doc.go and asserts the contract
  • docs/current-state.md — auto-regenerated by ./hack/refresh-current-state.sh (release-truth block now shows v0.10.9 published)

Quality gates:

  • make build
  • make test ✓ (full suite passes, new test in mcp package)
  • make lint
  • ./hack/verify-repo-truth.sh

Public-repo discipline: No real hostnames, IPs, usernames, or per-host diagnostic output. Commit author reset to a public-safe identity.

MCP tool annotations (readOnlyHint, destructiveHint, idempotentHint,
openWorldHint) are advisory metadata for well-behaved clients. They are
NOT a security boundary. All write attempts, regardless of how a client
sets its hints, pass through the AXIS safety blocker and execution
layer, which are independent of MCP and authoritative.

The new doc_test.go asserts the package doc contains the defense-in-depth
contract, so the safety boundary cannot be silently reworded away.

Refreshes docs/current-state.md (auto-regenerated by verify-repo-truth).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the current state documentation and adds a detailed 'Defense in depth' section to the axismcp package documentation, along with a test to ensure the documentation remains in sync. The review feedback suggests correcting a reference to internal/safety.Check in the documentation and removing a redundant dummy reference to NewServer in the test file.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread internal/mcp/doc.go Outdated
Comment thread internal/mcp/doc_test.go Outdated
Two review comments from gemini-code-assist on PR #150:

1. The package doc referenced 'internal/safety.Block', but the actual
   exported function is 'safety.Check' (internal/safety/blocker.go:20).
   Rename to 'safety.Check' to match the implementation. The test
   asserts the substring 'internal/safety' which still passes.

2. The test file referenced '_ = NewServer' as a defensive dummy to
   keep the test binary linked. In Go, 'go test' compiles all
   '_test.go' files in the package unconditionally; the dummy
   reference is redundant. Remove it.

Both changes are non-functional doc/test cleanup. Quality gates pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Owner Author

@toasterbook88 toasterbook88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed fixes in 2be0138:

  1. Renamed safety.Blocksafety.Check in doc.go. The exported function in internal/safety/blocker.go:20 is Check, not Block. The test assertion strings.Contains(doc, "internal/safety") still passes.
  2. Removed the redundant _ = NewServer dummy reference in doc_test.go. go test compiles all *_test.go files in the package unconditionally; the dummy was not needed.

Quality gates: make test ✓, make lint ✓. Ready for re-review.

@toasterbook88 toasterbook88 merged commit dd25405 into main Jun 2, 2026
9 checks passed
@toasterbook88 toasterbook88 deleted the chore/mcp-defense-in-depth-doc branch June 2, 2026 06:01
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