Repository navigation
fix(papyrus): refuse every route to anyone but the dashboard owner - #15966
Conversation
Papyrus routes were gated only on the app being enabled, so a non-owner dashboard subject or any app token could read, edit and delete the owner's papers, clone a remote onto the host, and commit and push with the owner's git credentials. The shared enabled wrapper now also runs require_owner_dashboard_request, so all 19 routes answer 403 owner_only to anyone but the owner. The page fetches with the owner's session cookie and the co-author agent uses file tools, so no app-token caller exists.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm in a live co-author session that the agent never hits these routes with an app token — the sweep backing own-app-token refusal was static. [DESIGN-REVIEWED] 8414c33 Description read[DESCRIPTION-READ] ad3e5b908cf0d3a67e795207b9233d74169128ad23297bd8be4a77efb1641f4d 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 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The papyrus wrapper is fixed, but the author's own harvested pattern — enabled-only wrappers with no owner gate — survives in 7 sibling builtin apps, unlisted. Not justified as shipped
What this change shipsInventory (5 items) — 4 justifiedIntent: keep anyone but the dashboard owner out of every Papyrus route — a FIX. (The patch's ~140 non-papyrus files match base commits #13236/#15924/#15900 already on main — test-merge drift, excluded from this inventory.)
[FIRST-PRINCIPLES-REVIEWED] 8414c33 Description read[DESCRIPTION-READ] 5e63285d3c8135b3a6a4092c55625a6ad82105cf8456d8960f0a0f1d6e31bcf5 That sha256 names the PR description this verdict read. Recompute it with |
Opus 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: |
|
|
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify a refused non-owner sees a legible error on the Papyrus page — [UX-REVIEWED] 8414c33 Description read[DESCRIPTION-READ] 1a17d26d32bb421fb5332438826d4ee2f2094be87c4c7b3ea1e0aaf26a1785a1 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
|
bolichen97
left a comment
There was a problem hiding this comment.
Approved: PR Readiness green on this head, merges cleanly into current main, no outstanding blocking review.
Problem / Motivation
Goal: Only the dashboard owner can use Papyrus.
Every Papyrus route checked one thing: is the app on? It never checked who was asking. So a signed-in dashboard user who is not the owner, or any app token, could do all of this:
Why it matters
Papers are private drafts. The push route runs git with the owner's own keys. Anyone a link lets into the dashboard could leak or overwrite the owner's work, and push in the owner's name.
Not a goal
gitops.py,latex.py,store.py). They were reviewed and are sound.What changed (motivation → approach → change)
Symptom: a non-owner gets 200 on every Papyrus route. Cause:
_require_enabledinsrc/kiro_crew/apps/builtins/papyrus/backend/routes.pyis the one wrapper on all 19 routes, and it only checked that the app was on.Fix: that same wrapper now calls the shared
require_owner_dashboard_requestonce the enabled check passes. Everyone but the owner gets its 403owner_only, with the usual SEL audit. A disabled app still answersapp_disabledfirst. One wrapper means a new route cannot miss the gate. meetings and aws_control gate the same way.owner_onlyowner_onlyowner_onlyowner_onlyThe spec
docs/system-specs/modules/papyrus.mdnow states this rule, in a new Caller authorization section of its Security model.Own-app tokens are refused too, because nothing uses one. The page (
website/src/apps/papyrus/api.ts) fetches with the owner's session cookie. Thepapyrus-writingskill edits files directly. No other module calls/api/apps/papyrus.Backwards compatibility
Compatible: the owner's page sends the owner's cookie (
app=="",user==owner), so everything it does still works. Writer sweep on origin/main @ 4224aa2: the only caller of these routes iswebsite/src/apps/papyrus/api.ts, a cookie fetch. No app token, MCP tool or agent calls them.Tests
In
test/test_papyrus_routes.py, newTestOwnerGate:test_every_route_refuses_a_non_owner_caller: walks all 19 registered routes for 4 callers (non-owner, own-app token, other app token, internal with no app claim). Each must get 403owner_only.test_owner_reaches_every_route: the owner reaches all 19.test_registered_push_and_commit_never_reach_git_for_a_non_owner: mockedgitops.push,commitandcloneare never called.test_disabled_check_still_answers_first: a disabled app still saysapp_disabled.TestRequireEnabled::test_allows_the_route_when_enablednow sends the owner's identity.Fails before: with the
routes.pychange reversed, the 5 refusal tests fail and the controls pass. With it applied, all pass (255 papyrus route and store tests).Manual verification
N/A — unit coverage is enough. The tests drive the real registered handlers through the real shared gate.
Related Issues
N/A — found in an internal security review.
Pattern harvest
Rule candidate: review-prompt
Pattern: an app route wrapper that checks only that the app is enabled and never calls the shared owner gate.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
N/A — placeholder pending OSPO wording.