Skip to content

fix: allow read-only token on read POST endpoints (#524) - #525

Merged
ajianaz merged 1 commit into
developfrom
fix/read-only-token-post-read-endpoints-524
Jul 1, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/read-only-token-post-read-endpoints-524

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

Read-only token blocks all POST endpoints with 403, including reads like POST /recall, POST /list, POST /search. Clients (e.g. CorIn desktop) that query memories via these endpoints get empty data with a read-only token.

Fixes #524.

Root Cause

The read-only middleware used a blanket method != Method::Get check (line 49), blocking all non-GET requests regardless of whether they are reads or writes.

Fix

Replace blanket HTTP method check with per-endpoint allowlist based on operation semantics:

POST Path Operation ReadOnly?
/recall, /search, /list, /stats Read queries ✅ Allow
/room/recall, /room/summary, /room/document, /room/stats Room reads ✅ Allow
/doc/get, /doc/list, /doc/search Document reads ✅ Allow
/remember, /forget, /room/create, /room/delete, /doc/create, /doc/move, /doc/delete, /context, /dream, /mcp Writes ❌ Block

All GET endpoints remain unchanged (already allowed).

Security note

  • Exact path match only (path == *ep) to prevent prefix-based bypass (Cora flagged this).
  • MCP endpoint (/mcp) still blocked for read-only — it can perform writes via uteke_remember tool.

Files

  • crates/uteke-server/src/handlers.rs — replace blanket check with allowlist

Read-only token was blocking ALL POST endpoints (403), but many POST
endpoints are reads (/recall, /search, /list, /stats, /room/recall, etc.).

Changed: blanket 'method != GET' check → per-endpoint allowlist based on
operation semantics. ReadOnly tokens can now:
- POST /recall, /search, /list, /stats (read queries)
- POST /room/recall, /room/summary, /room/document, /room/stats (room reads)
- POST /doc/get, /doc/list, /doc/search (document reads)
- All GET endpoints (unchanged)

Still blocked:
- POST /remember, /forget, /room/create, /room/delete, /doc/create,
  /doc/move, /doc/delete, /context, /dream, /mcp (all writes)
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-cli · BYOK · MIT

@ajianaz
ajianaz merged commit 21a932b into develop Jul 1, 2026
8 checks passed
@ajianaz
ajianaz deleted the fix/read-only-token-post-read-endpoints-524 branch July 1, 2026 17:51
ajianaz added a commit that referenced this pull request Aug 13, 2026
…d-endpoints-524

fix: allow read-only token on read POST endpoints (#524)
ajianaz added a commit that referenced this pull request Nov 11, 2026
) (#1725)

The rooms field on memory hits is CORE (contract amendment 4 point 1,
uteke-cloud #525). Exact-value tests now pin it on POST /recall (plain,
fusion, unified, pack, explain), POST /search, POST /room/recall with a
query, MCP uteke_recall, uteke_search and uteke_room_recall, and the CLI
--json of recall, search and room recall: the list shape, the sort by
room_id, room_name as the title or the id for a missing or blank title, the
omitted key for a memory in no room, no rooms on a document item, and no
leak from a hit cut by limit. A test reads docs/core-contract.json so the
three routes must stay CORE. Mutation-checked by hand.

Also: connect_hooks tolerates a broken pipe when a hook exits before
reading its stdin (a race already on develop), and the unified hit check
skips document items instead of panicking.
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.

Read-only token should allow read endpoints (/list, /recall, /search, /version) — currently 403s all POST

1 participant