Repository navigation
feat(safety): global read-only mode, mutation audit trail, MCP tool allowlist - #3
Merged
Merged
Conversation
…llowlist Implements F7 from the deep analysis — the AI/MCP safety pack: - KVIEW_READONLY=true rejects every mutation with a clear 403, for all clients and all roles (filter ahead of the security chain); the web UI shows a banner and GET /api/meta reports the mode for scripts - KVIEW_AUDIT=true appends one JSONL line per mutation to <data-dir>/audit.log: timestamp, client (X-Kview-Client), method, full path (cluster + topic + action) and response status; payloads never logged - all three clients identify themselves with X-Kview-Client (kview-ui / kview-cli/<v> / kview-mcp/<v>) so an agent's writes are distinguishable from a human's in the audit log - MCP server: KVIEW_ALLOWED_TOOLS restricts the served tools to a comma-separated allowlist (e.g. read-only tools for an AI agent); disallowed calls get a clear error listing the enabled tools - tests: read-only matrix (mutations refused, reads + read-shaped POSTs fine, meta public) and audit trail (mutation lines, reads not audited); MCP allowlist verified over stdio; full suite 49/49
This was referenced Sep 26, 2026
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.
Implements F7 — the AI/MCP safety pack from the deep analysis: "the Kafka tool that can prove what an agent did and refuse to let agents write." Pairs with the auth feature in #2. Stacked on #2 (touches
SecurityConfig.java,CHANGELOG.md,README.md,cli/kview.mjs,mcp/kview-mcp.jsthere) — merge #1 → #2 → this.What's added
Global read-only mode —
KVIEW_READONLY=trueKview is running in read-only mode…), for all clients and all roles. Implemented as a filter ahead of the security chain, so the reason is "read-only" rather than "unauthorized".GET /api/meta, which also lets scripts detect the mode).Mutation audit trail —
KVIEW_AUDIT=true<data-dir>/audit.log: timestamp, client, method, full path (cluster + topic + action) and response status. Message payloads are never logged.X-Kview-Clientheader —kview-ui,kview-cli/<v>,kview-mcp/<v>— so an AI agent's writes are distinguishable from a human's. Unknown clients fall back to their User-Agent.MCP per-tool allowlist —
KVIEW_ALLOWED_TOOLStools/listand dispatchable, and a disallowedtools/callgets an error listing the enabled tools. E.g. serve an agent onlykview_overview,kview_browse,kview_topics. Builds on the existingconfirm=trueguard for destructive calls.Verification
/api/metapublic and reportingreadonly:true), audit trail (mutation lines with method/path/status/client; reads not audited).