Repository navigation
fix(dashboard): apply the owner gate to session history, knowledge reads and task actions - #22838
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change reuses the existing owner-gate pattern, the break is listed and accepted, and a revert undoes it cleanly. Notes
[DESIGN-REVIEWED] 82485f0 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The gate protects a named boundary: several people reach one gateway through channel allowlists. The new tests fail on base. One identical copy of the helper is still inline. Notes
What this change shipsInventory (7 items) — 6 justifiedIntent: let only the dashboard owner read or delete their chat history and knowledge library, and act on their waiting runs. FIX.
[FIRST-PRINCIPLES-REVIEWED] 82485f0 Description read[DESCRIPTION-READ] bd519d553e850031d4165599cf16b69724c640f535b03ec57b0539df0cabdc6b That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
buluoray
left a comment
There was a problem hiding this comment.
Reviewed at 1e9d53486a552ab65e86bae4b802be08664a3add.
Requesting changes: one route that serves the same transcripts is still open.
The gate itself is right. require_owner_for_dashboard_caller applies the owner check only to a present, empty app claim, and the check underneath fails closed on an absent claim, an empty user or a non-owner subject. App and internal callers keep the controls they already had. I re-ran test_dashboard_owner_gate_history_kb_tasks.py (83 passed) and the related session, knowledge, tasks and facade suites (684 passed). Then I dropped each new gate one at a time: both dashboard_owner_only flags, both task gates, the helper and all 19 knowledge read gates. Each mutant turned a named test red.
Blocking: POST /api/sessions/summarize (sessions_parts/summaries.py). This route has the same app-only check this PR fixes. Its guard_owner_surface_routes(...) call at line 301 does not pass dashboard_owner_only=True (history_reads.py does, at line 595), so with an empty app claim has_log(key) is the only test. Through the real middleware and route table, with the model call stubbed, a non-owner dashboard session sent {"keys":["dashboard:owner-chat"]} and got 200 with a summary of the owner's transcript. It also spends the owner's model credit. First Principles item 2 flagged the same route and it has no reply yet.
The fix is one line, adding dashboard_owner_only=True to that call. Nothing in the website calls this route, and the MCP list_sessions leg uses the internal secret with no app claim, so it still passes. With that line added, the same probe returns 403 owner_only, and test_dashboard_sessions_summarize.py and test_member_memory_api.py still pass. Please add a refusal test next to the other history routes.
Non-blocking follow-ups:
GET /api/sessions/{id}/agentsand/agents/{agent_id}(core.py, plain guard) return a session's subagent results to a non-owner dashboard session. They belong to the same family.GET /api/tasks,/api/tasks/summaryand/api/tasks/{id}stay open to non-owner sessions. That fits the "task actions" scope, but the module docstring could say so.- First Principles item 5:
_require_knowledge_owneris now a pass-through and could be removed. Design note: consider making the dashboard owner check the default inguard_owner_surface_routes, so a new owner-data module can't forget the flag. - The branch conflicts with main in
docs/system-specs/modules/learn-cron-dashboard.mdand needs a rebase.
1e9d534 to
1dc9496
Compare
|
Thanks @buluoray. Addressed in 1dc9496 (rebased onto current main, conflict in
|
buluoray
left a comment
There was a problem hiding this comment.
Re-reviewed at 1dc9496. Approve.
My blocker is fixed: sessions_parts/summaries.py now passes dashboard_owner_only=True to guard_owner_surface_routes (line 307), so POST /api/sessions/summarize gets the same owner gate as the other history routes. The new commit adds test_a_non_owner_dashboard_session_cannot_summarize_a_transcript and test_the_owner_summarizes_a_transcript, which pin both sides. The branch is rebased onto current main, which also clears the docs conflict.
The one red check on this head is Real Adapter Contract Tests, the pi lane that is red on main itself and is fixed by #22951; it is unrelated to this change.
The non-blocking follow-ups from my earlier review still apply (/api/sessions/{id}/agents, the ungated task reads, _require_knowledge_owner as a pass-through).
…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.
POST /api/sessions/summarize derives its reply from the owner's transcripts, so it now uses the same dashboard_owner_only guard as the history reads. The owner and the internal list_sessions caller are unchanged; a non-owner dashboard session gets 403 owner_only before any read or model call.
1dc9496 to
82485f0
Compare
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.