Repository navigation
docs(adr): ADR-0042 security kernel as library code inside qq-core/qq-mcp (SK0) - #163
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…-mcp (SK0) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
4 of 5 tasks
Contributor
Author
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
Collaborator
|
Thanks for this contribution — the tool-set pinning idea is one we want in QQ, and the reviewed design has now landed as a single integration PR: #194 ( #194 ports the MCP pinning delta from this stack and repairs the issues found in review (details and reproducing probes in the PR description and
This PR will be closed as superseded once #194 merges. |
lg2m
added a commit
that referenced
this pull request
Sep 26, 2026
… dispatch; add qq mcp inspect (#194) * feat(mcp)!: pin MCP tool sets in config and plan identity; enforce at dispatch; add qq mcp inspect An MCP server's tool descriptors are untrusted text the model reads as instructions, and the server may change them at any time. A server declaration may now carry `pin`: the SHA-256 tool-set digest (64 hex digits, validated at load) of the listing an operator reviewed. A pinned server whose listing digests differently is quarantined: it contributes no tools, the readiness message names both digests, and every call to it is refused (`McpCallFailure::Quarantined` -> `HostCallError::Refused`). This takes over the contributed stack #163 / #165 / #171 and ships only the MCP pinning delta, repaired against QQ's own contracts (ADR-0046): - Dispatch-time enforcement. A pinned call resolves the cached listing before waiting for a permit, re-checks the listing generation and the `list_changed` flag after it, requires the tool to be in that listing, and sends exactly one `tools/call` whose enqueue poll runs under a synchronous dispatch gate shared with `on_tool_list_changed`, `bump_generation`, and `shutdown`. Previously a queued call that passed the pin check executed after the server was quarantined. - Durable identity. `McpServerDescriptor.pin` is recorded and `DESCRIPTOR_VERSION` moves 9 -> 10; pinned and unpinned plans no longer share a digest. - Injective digest. Domain `qq-mcp-tool-set-v2` with length-prefixed fields replaces the `\0`-separated v1 encoding. - Whole listings only. Malformed or duplicate tool names fail the listing instead of being skipped before hashing; fetches are bounded to 32 pages, 512 tools, and 1 MiB; a `list_changed` during a fetch discards it. - Inspection. `McpManager::inspect` and `qq mcp inspect NAME` print the live digest and every descriptor as JSON without calling a tool, so the digest is reviewed before it is pinned rather than copied out of a quarantine error. The per-event audit hash chain from #165 is not ported: it has no consumer, checkpoint, or retention contract yet, and its verifier accepted a cursor rewrite. Approval/argument binding is deferred. Breaking: `DESCRIPTOR_VERSION` 9 -> 10 invalidates cached plan digests (recompiled on next load; no store migration). No protocol change. Verification: fmt, clippy (-D warnings), workspace build and tests, the minimal qq-provider profile, and `plan_compile` bench within noise of the baseline (ledger `docs/plans/progress/mcp-pinning.md`). Closes ENG-939. Supersedes #163, #165, #171. Co-Authored-By: romy <[email protected]> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(mcp): count listing descriptor bytes without buffering an encoded copy Codex review on #194: `serde_json::to_vec(tool)` allocated the whole encoded descriptor before the 1 MiB check, doubling the resident bytes for a page `rmcp` had already decoded. Measure through a counting `ByteBudget` writer instead; the write that crosses the budget is rejected and nothing is allocated. The check now bounds only what it claims to bound; the transport read limit remains an `rmcp` concern (SSE events are capped at 16 MiB there, stdio lines are unbounded) and is noted in the ledger. Co-Authored-By: romy <[email protected]> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: romy <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for users
None (docs only). Opens the
security-kernelplan: the Axiom → qq port of fail-closed guarantees (workstream a, integration plan A1–A3).Why / design
ADR-0042 fixes the integration boundary before any code lands: Axiom's guarantees (hash-linked audit, MCP tool-set pinning/quarantine, approval ledger + bound commit) are ported as qq-native library code in the crates that already own the state (
qq-core::sessions::store,qq-core::approval,qq-mcp). Noaxiom-*dependency, no new crate, no service/socket. The single-owner SQLite store (ADR-0022) is the trust root, so Ed25519 identities, issuer keys and revocations are deliberately not ported; hashing uses SHA-256 via the existingsha2dependency instead of BLAKE3 (no new dependency; swap is a re-chain). Audit sinking, tenancy and scale stay above qq (ADR-0009).Also adds:
docs/plans/security-kernel.md— slices SK1 (A3, schema 36→37), SK2 (A2,pinon MCP server declarations), SK3 (A1,tool_calls.authorized_by, name/argument-boundstart_tool_call, at-most-once), acceptance per slice, and deferred decisions (grant attenuation, chain anchoring).docs/plans/progress/security-kernel.md; ADR-0042 reserved inroot.md(next free: 0043); index rows indocs/adr/README.md,docs/plans/README.md,docs/plans/progress/README.md.Follow-up PRs SK1 → SK2 → SK3 stack on this branch.
Note: branch name follows the workstream instruction
devin/<timestamp>-<slug>rather than thetype/convention inAGENTS.md.Linear: ENG- (none assigned; workstream dispatched directly)
Slice: docs/plans/security-kernel.md#SK0
How verified
Docs only; no Rust changes.
cargo fmt --all -- --check(n/a, no code)cargo clippy --workspace --all-targets --all-features -- -D warnings(n/a)cargo test --workspace(n/a)cargo test -p qq-provider --no-default-features --features test-support(n/a)Impact
docs/adr/0042-security-kernel-inside-qq.md,docs/plans/security-kernel.md, ledgers/indexes aboveLink to Devin session: https://app.devin.ai/sessions/4a83e789a14d4b4190950fb8678d668e
Open in Devin Desktop: https://app.devin.ai/desktop/session/4a83e789a14d4b4190950fb8678d668e?variant=devin
Requested by: @integrate-your-mind