Repository navigation
fix(dashboard): apply the owner gate to session history, knowledge reads and task actions - #22704
iamwhatever wants to merge 1 commit into
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The new gate reuses the owner rule the knowledge writes and vault routes already apply, and it only touches empty-app-claim callers. Notes
[DESIGN-REVIEWED] 1e9d534 Description read[DESCRIPTION-READ] 1f51b49cbadd08bacebba140ac0c53e79ad9783880a19165910670e30ba76f6d That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This fix restores the owner boundary that linked channel sessions were getting past. It extracts one shared helper but leaves a third identical copy of the gate unconverted. Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: a dashboard session reached through someone else's Telegram, Teams or Webex link can no longer read, delete or act on the owner's history, knowledge library or waiting runs. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 1e9d534 Description read[DESCRIPTION-READ] bd519d553e850031d4165599cf16b69724c640f535b03ec57b0539df0cabdc6b That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
bolichen97
left a comment
There was a problem hiding this comment.
Not ready: the owner gate closes transcript detail, but the same transcripts stay readable through the archive and search routes in the same file.
Head reviewed: 842de9c. Bots read: Design PASS, First Principles BLOCK, UX skipped, Opus no blocking, GPT no blocking, readiness checking. Backend tests and coverage have not run on this head yet (Coverage Gate failed closed because the backend jobs were skipped).
1 must-fix, 0 should-fix.
What I checked:
- All 19 GET routes under
/api/knowledgenow call the gate, and the new test pins that list againstsetup_knowledge_routes. Good. - The task answer and cancel routes gate before the body read, and the tests use a real task store. Good.
require_owner_for_dashboard_calleronly refusesapp == ""callers, so app tokens and internal callers keep their current controls.
The must-fix (inline) agrees with the First Principles blocker: the Goal says session history answers the owner only, but GET /api/session/archive/{name} still returns a full transcript to a non-owner linked session, and GET /api/sessions/search still returns content matches to it. If you decide these routes are out of scope, please amend the Goal and name them as a residual, and I will withdraw this.
Not repeated: the pass-through _require_knowledge_owner (First Principles note) and the owner-on-their-own-channel-link case (Design note).
| # conversation, and a non-owner dashboard session (a Telegram, Teams or Webex | ||
| # allowlist link) holds the same empty app claim that check lets through. | ||
| # Before any transcript read, so a denial costs no read. | ||
| owner_denied = await require_owner_for_dashboard_caller(request, "sessions.detail.read") |
There was a problem hiding this comment.
🔴 Archived transcripts and search hits stay open to the non-owner session this gate refuses
This change refuses a non-owner dashboard session on GET /api/sessions/{key}. In the same module, api_session_archive_read returns the full archived transcript (up to 250 KB of JSONL) to any caller, and api_session_archive_list lists every archive name. api_sessions_search runs search_sessions over all transcripts for any caller with an empty app claim, and api_session_meta returns titles. None of them call the new gate. So a Telegram, Teams or Webex linked session that now gets 403 here can list the archives and read the same conversation from the archive route.
owner_denied = await require_owner_for_dashboard_caller(request, "sessions.detail.read")Why it matters: the Goal is "Session history ... answer the dashboard owner only". With these routes open, the 403 on detail does not keep the owner's transcripts private, and the PR states a protection that does not hold.
Suggestion: call require_owner_for_dashboard_caller at the top of api_session_archive_list, api_session_archive_read, api_sessions_search and api_session_meta (and api_sessions_clearable_count in delete_routes.py), and add them to the parametrized refusal tests. If some of them must stay open for a linked session, name them in the Goal as a residual instead.
Rule: Description and diff fidelity; the frozen Goal of this PR.
…ads and task actions
GET and DELETE /api/sessions/{key} and DELETE /api/sessions, every
GET /api/knowledge/* read (the whole-library export included), and
POST /api/tasks/{task_id} and its /cancel sibling now answer the
dashboard owner only. A Telegram, Teams or Webex allowlist link holds the
same empty app claim as the owner's own session, and the app-isolation
checks on these routes admit every such caller, so a non-owner dashboard
session could read or delete any transcript, export the library, or feed
an answer into (or end) the owner's waiting run.
The new require_owner_for_dashboard_caller gates the dashboard-user class
only and is layered under the existing app checks: an app token keeps its
uniform 404, its own transcripts and its manifest scope, and an
internal-secret caller keeps its own door. _require_knowledge_owner now
delegates to it, so the library has one rule for reads and writes.
842de9c to
1e9d534
Compare
|
Addressed in 1e9d534. Blocker (session-history point patch): fixed as suggested. The per-handler calls are gone. Note ( Design note (owner via own channel link): stated in the description under Backwards compatibility. |
bolichen97
left a comment
There was a problem hiding this comment.
The earlier must-fix is fixed on this head, so I am withdrawing my change request. This is an authorization change, so it still needs a maintainer to approve it; I am not approving it.
Head reviewed: 1e9d534 (rebased onto main; the PR's own change is one commit). Bots read on this head: Design PASS, First Principles PASS, UX skipped, Opus no blocking, GPT no blocking. Readiness is still checking and Lint Gate is queued.
0 must-fix, 1 should-fix.
What I checked, route by route:
history_reads.pyanddelete_routes.pynow callguard_owner_surface_routes(..., dashboard_owner_only=True), so everyapi_session*handler in those modules runsdashboard_owner_surface_guardbefore its body. That coversapi_sessions,api_sessions_search,api_session_detail,api_session_meta,api_session_archive_list,api_session_archive_read,api_session_delete,api_sessions_clearandapi_sessions_clearable_count. A handler added to those modules later is gated by default.- The guard refuses only an empty app claim whose user is not the owner. App tokens and internal callers (no
appkey) pass through to their existing controls; the caller-class test pins all four classes. - The new tests go through the real token middleware and
register_all.OTHER_HISTORY_READScovers the list, search, meta, archive list, archive read and clearable count, and asserts 403owner_onlywith no transcript text in the body for a non-owner session. Detail, delete and clear have their own tests. A wrong route path would come back 404 and fail these tests. - The First Principles note on
_require_taskrunner_owner(same body as the new helper) and the extra facade export are cleanup only. Not blocking.
Should-fix: POST /api/sessions/summarize (summaries.py) is still open to the same caller. With an empty app claim the handler only checks log.has_log(key) and then returns an LLM one-line summary of that transcript, so a non-owner linked session that knows a key still gets a digest of the owner's conversation. It also spends a model call per key. The list and search routes no longer hand out keys, so this is narrower than before. The fix is one line: pass dashboard_owner_only=True to the guard_owner_surface_routes call at the bottom of summaries.py, and add /api/sessions/summarize (POST) to the refusal tests. If you want that route to stay open, please name it as a residual in the Goal.
The Design note still applies before merge: an owner who opens the dashboard through their own channel link now gets 403 on history, so the sidebar should show that as owner only, not as an empty pane.
The earlier must-fix (archive, search, meta and clearable-count routes open to a non-owner linked session) is fixed on 1e9d534. Withdrawing; this still needs a maintainer approval.
|
superseded by #22838 |
Problem / Motivation
Goal: Session history, knowledge-library reads and task actions on the dashboard answer the dashboard owner only.
A linked chat-channel session (Telegram, Teams or Webex allowlist link) reaches the dashboard with the same empty app claim as the owner's own session. The app-isolation checks on
GET/DELETE /api/sessions/{key},DELETE /api/sessions, theGET /api/knowledge/*reads andPOST /api/tasks/{task_id}(plus/cancel) admit every such caller, so these routes were not limited to the owner.Why it matters
Transcripts, the knowledge library and the owner's waiting runs are the owner's data. A non-owner linked session should not read, delete or act on them.
Not a goal
What changed (motivation → approach → change)
require_owner_for_dashboard_callerindashboard/handlers/_shared_access.py, which gates only the dashboard-user class (empty app claim) and passes every other caller to the control that already governs it.guard_owner_surface_routes(_shared_route_guards.py) gains adashboard_owner_onlyflag, andsessions_parts/history_reads.pyandsessions_parts/delete_routes.pyset it. Everyapi_session*route in those two modules (list, search, detail, meta, archive list and read, delete, clear, clearable count) now runs the existing private-member check and then the owner check, before the handler. Other modules keep the plain guard.knowledge_*.py) and in the two task action routes (tasks.py)._require_knowledge_ownernow delegates to it, so the library uses one rule for reads and writes.knowledge.md,learn-cron-dashboard.md) describe the gate.Backwards compatibility
Breaking: a non-owner dashboard session now gets 403
owner_onlyon these routes. Writer sweep on origin/main: the owner's own dashboard session, app tokens and internal-secret callers are unaffected.Note: the owner signing in through their own channel link gets a token whose subject is the channel user, not
owner_id, so that session is also refused here, as it already is on the existing owner-gated routes.Reader: src/kiro_crew/dashboard/handlers/sessions_parts/history_reads.py:api_session_detail -- crew page -- owner session passes; test_dashboard_owner_gate_history_kb_tasks.py
Reader: src/kiro_crew/dashboard/handlers/sessions_parts/history_reads.py:api_sessions -- crew page -- owner session passes; test_the_owner_passes_the_gate_on_every_history_read
Reader: src/kiro_crew/dashboard/handlers/sessions_parts/history_reads.py:api_session_archive_read -- crew page -- owner session passes; test_the_owner_passes_the_gate_on_every_history_read
Reader: src/kiro_crew/dashboard/handlers/sessions_parts/delete_routes.py:api_session_delete -- crew page -- owner session passes; test_dashboard_owner_gate_history_kb_tasks.py
Reader: src/kiro_crew/dashboard/handlers/knowledge_library.py:list_namespaces -- crew page -- owner session passes; test_dashboard_owner_gate_history_kb_tasks.py
Reader: src/kiro_crew/dashboard/handlers/tasks.py:api_task_action -- crew page -- owner session passes; app tokens unaffected; test_dashboard_owner_gate_history_kb_tasks.py
Tests
test/test_dashboard_owner_gate_history_kb_tasks.py(new): through the real token middleware and route table, a non-owner dashboard session is refused with 403owner_onlyon every session history route, every knowledge read and both task actions; the owner passes; an app token keeps its 404 / own-transcript / manifest-scope answers.dashboard_owner_surface_guardis checked on all four caller classes (owner, non-owner dashboard, app token, internal caller). Existing knowledge, sessions, tasks and facade suites pass.Manual verification
N/A — unit coverage exercises every gated route with each caller class.
Related Issues
N/A
Pattern harvest
Rule candidate: review-prompt
Pattern: "a dashboard route guarded only by an app-isolation check also needs the owner gate for empty-app-claim callers"
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.