Skip to content

feat(cli,server): uteke view, a read-only browser viewer (#1470 b) - #1653

Merged
ajianaz merged 1 commit into
developfrom
feat/viewer-1470
Nov 3, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/viewer-1470

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

What

uteke view [--port N]: a read-only browser viewer for #1470 (b). It lists memories (namespace filter), namespaces with counts, rooms and health. It is uteke-serve --viewer, a separate loopback listener, not an API route, so CORE/LAB are unchanged and docs/api-reference.md does not change.

  • Every request needs a random per-launch token (cookie, X-Uteke-Viewer-Token or bearer; the launch URL carries it once, on / only): 401 without it.
  • Host goes through the existing HostGuard from ReqCtx (no second guard), plus a port check: 403 for anything but 127.0.0.1:<port> / localhost:<port>.
  • Only GET; anything else is 405. A GET reaches the API router only for six listed routes and only while the registry row has writes = false.
  • No CORS headers (even if uteke.toml sets origins), CSP with per-response nonce, no-store, nosniff, X-Frame-Options: DENY.
  • A non-loopback --host is refused unless the server auth token is set.
  • Stored text is put in the DOM with textContent only; the page has no innerHTML.
  • One static HTML file plus the vendored plain-CSS @codecora/tokens (uteke/uteke-dark), no build step or framework.

Why

#1470 (b), approved by the owner; also gives a surface for human review (Atlas finding 16, #1601). Loopback alone is not a control (local processes, DNS rebinding), hence token + Host + method + registry gating. Plan: docs/plans/2026-10-29-dx-bundle-1470.md section 3.

Testing

  • cargo test -p uteke-server viewer: 13 tests: no token 401, wrong token 401, token in the query only opens /, foreign/wrong-port Host 403 (checked before the token), every non-GET method on several paths 405, write/unlisted routes 404, read routes 200 with no Access-Control-* even when config sets *, every allowed route is a registry read, page CSP nonce and no innerHTML, a stored <script> string comes back verbatim as JSON with nosniff.
  • cargo test -p uteke-cli (skill coverage test: both SKILL copies list uteke view), cargo clippy --workspace --all-targets, cargo fmt --check.
  • Manual: real binaries, curl (401/403/405 as above, no CORS header) and the page in a browser: a memory containing <img onerror> and <script> renders as literal text, tabs load, token is removed from the address bar.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit aba0d5a into develop Nov 3, 2026
15 checks passed
@ajianaz
ajianaz deleted the feat/viewer-1470 branch November 4, 2026 06:46
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