Repository navigation
s1: request-level identity gate + read-only MCP proxy allowlist - #90
Open
jasandroidx wants to merge 1 commit into
Open
jasandroidx wants to merge 1 commit into
jasandroidx wants to merge 1 commit into
Conversation
- new request middleware (src/start.ts) runs before every SSR page load and
server function; 401 unless Tailscale-User-Login is allowlisted (operator
default) or a tagged device carries KEEP_INTERNAL_TOKEN; loopback dev
override only with VITE_AUTH_ENABLED=false; Vercel previews skipped
- callFastMCP browser proxy refuses anything outside KEEP_READONLY_TOOLS (12
read-only tools); county audit + Oracle verify + every write/human-gate
tool stays blocked, surfaced as blocked:true in the Sentinel panels
- preview bearer auth moved from GET-query context into the Authorization
request header so the token never lands in URLs or logs
- gateway log tail normalized to {ok, lines[], error?} via getGatewayLogs
(execFile, fixed args, authMiddleware); Raziel names the gateway model only
when observed live (openclaw_models, 3s race) or says it is unknown
- header identity badge (getKeepIdentity) replaces the dev-build chip
- unit tests for both pure modules; parseAllowedLogins(undefined) keeps the
default, explicit empty string locks the tailscale path to nobody
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
s1-lock-doors: every request into the Keep now carries a provable identity, and the browser proxy can only reach read-only MCP tools.
What changed
Request-level identity gate (all SSR page loads + server functions)
src/start.tsregisterscreateKeepGateRequestMiddleware()— it runs before every SSR render and server function (and/api/auth/*). Returns401unless the request clears:VITE_AUTH_ENABLED=falseand a loopbackHost— the dev override, which can never fire through Tailscale serveTailscale-User-Login∈KEEP_ALLOWED_LOGINS(defaults to the operator login; explicit empty value locks the Tailscale path to nobody)x-keep-internal===KEEP_INTERNAL_TOKEN(tagged-device bearer)createCsrfMiddlewareis restored explicitly so CSRF protection survives replacing the framework's default middleware array./assets/,/hall/,/__grok/, common extensions) are exempt; everything else — including SSR HTML — is gated.src/lib/auth/tailscale-gate.ts(no React imports, unit-tested 1:1).Read-only proxy allowlist
callFastMCP(the browser's POST proxy) now refuses any tool outsideKEEP_READONLY_TOOLS— exactly 12 read-only tools — and stripsconfirmfrom params. Refusals returnblocked: true.audit_county_budgetandoracle_verifystay refused: the audit pipeline is frozen, andoracle_verifyhas no registered implementation on the fortress MCP surface (see follow-up below). The Sentinel panels now render an explicit "🛑 Tool blocked by the Keep allowlist" box for these, never a fake bridge error.decideGateserver function (unchanged).Auth header hardening
sendContext(which TanStack serializes into the URL) into theAuthorizationrequest header; the server hook reads it back viagetRequest()from@tanstack/react-start/server.Honest gateway + model display
tail_gateway_logsproxy path replaced by a normalizedgetGatewayLogsserver function ({ ok, lines[], error? },execFilefixed args, fail-closed) — the Mechanic streamer renders exactly that shape, "UNREACHABLE" when unreadable.openclaw_models, 3s timeout race) — otherwise he says he cannot see it, never invents one.getKeepIdentity.Tests
src/lib/auth/tailscale-gate.test.ts+src/lib/keep/fastmcp-allowlist.test.ts(allowlist refusals incl.county_queue_approve,write_repo_file,service_restart,audit_county_budget,oracle_verify;stripConfirm).Validation
npm run typecheck✅npm test✅ 84/84 (requires a Node build with the TS type-stripping engine — the box's distro/usr/bin/nodev22.22.1 is compiled without it; tests run under official Node 22.23.2 at/opt/node-v22.23.2-linux-x64, repo untouched)npm run build:box✅Deploy notes (box, after merge)
npm run build:box+systemctl restart ravenstack-keep-ui(token/env lives in gitignoredui-v2/.env; already present — the service restart loads it).KEEP_INTERNAL_TOKENwas generated on the box and appended toui-v2/.env(chmod 600); it is not in this PR, tests, or logs.Follow-up (labeled
jules)oracle_verifyremains blocked pending a real implementation on the fortress MCP; re-review once one exists.