Repository navigation
fix(shared-crew): keep the portability export and import the owner's - #38294
KiroCrewCaptain wants to merge 1 commit into
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. One entry in the existing teammate deny-list puts portability back behind the owner gate, it is the one place that gate reads, and the relay's limit is unchanged. Notes
[DESIGN-REVIEWED] 7b14c64 Description read[DESCRIPTION-READ] a963b14a14d52e2a07a11c7bddd59d2ce6b0c237c36af58a6389fe9f3fa44ddf 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. One regex entry in the existing teammate owner-only table puts back the portability refusal that #38209 dropped. Before #38209 the base already refused teammates on these routes, so this is a restore and not a new shape. What this change shipsInventory (4 items) — 4 justifiedIntent: the owner's raw config can no longer be downloaded or overwritten by a Shared Crew teammate through portability export/import. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 7b14c64 Description read[DESCRIPTION-READ] e60af208a075bade176343c5b17b4bfd952168494fb973c9d4ad1b28b3d3fb12 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: |
Since #38209 the owner gate admits a Shared Crew teammate on every route the owner-only table in shared_crew.teammate_access does not list, and /api/portability was in none of its entries. The export writes config.json and the settings documents, config.local.json among them, raw into the archive, so a channel bot token or an agent env secret a teammate downloaded would outlive their access. The import, with mode=replace, overwrites the owner's config. Add PORTABILITY_ROUTES to that table, so is_owner_only_for_teammates keeps every /api/portability route the machine owner's and the export and import refuse a teammate 403 owner_only. This restores main's behaviour from before #38209, when both routes refused every teammate. The relay's remote_route_limit is unchanged, so what a relayed remote caller gets does not move, and the preview, which asks no owner gate, is unaffected.
e824484 to
7b14c64
Compare
|
The review found nothing blocking on this head. This change narrows who can use an owner gate, so a maintainer gives the final approval. What the review checked on 7b14c64:
Security: the change only tightens access. It brings back owner-only export and import as they were before #38209, and #38209 is not in any release. The relay's Done well: the fix lives in the one table the shared owner gate reads, so no handler needed an edit. The end-to-end tests prove a teammate never reaches the export planner or the upload reader. Optional:
|
Problem / Motivation
Goal: A Shared Crew teammate can no longer download the owner's raw config through the portability export, or overwrite it through the import, as on main before #38209.
Since #38209 the owner gate (
source_providers.is_owner_dashboard_request) admits a Shared Crew teammate on every route thatshared_crew.teammate_access.is_owner_only_for_teammatesdoes not list, and/api/portabilityis in none of its entries. So a teammate getsGET /api/portability/export, whose archive carriesconfig.jsonand the settings documents raw, andPOST /api/portability/import, which rewrites them.Why it matters
The export carries the owner's raw config, which can hold channel bot tokens and agent env secrets, and a teammate keeps that download after the owner revokes their access. The import, in
replacemode, lets a teammate overwrite the owner's config and settings. Every owner who shares a Crew through an SSM invite, a team Crew relay or a Tailscale path is exposed. On main before #38209 both routes refused every teammate.Not a goal
kiro_relay.limits.remote_route_limitandis_local_credential_pathare untouched.What changed (motivation → approach → change)
CRON_SECRET_GRANTS,CHANNEL_CONNECTION_WRITES, and the relay's path table).teammate_access.PORTABILITY_ROUTESmatches/api/portabilityand every route under it, andis_owner_only_for_teammatesreturns true for it, so both handlers' existingrequire_owner_dashboard_requestanswers a teammate 403owner_only. The entry sits in the teammate table, not in the relay'sremote_route_limit, so a relayed remote caller's boundary does not move. The module docstring anddocs/system-specs/modules/shared-crew.md("What a teammate may do") now say why portability stays the owner's.Backwards compatibility
Breaking: a Shared Crew teammate's
GET /api/portability/exportandPOST /api/portability/importanswer 403owner_onlyagain, as they did before #38209. Writer sweep on origin/main @ ed37d89:git grep -n "api/portability"finds one client, the dashboard's Portability card, which shows a 403 inline; the CLI and the snapshot code call the portability module in process and never reach the route; an app token never passed the owner gate.Reader: website/src/pages/overview/PortabilityTab.tsx:PortabilityTab -- crew page -- a teammate's export or import shows the 403 inline, as before #38209; PortabilityTab.staleOwner.test.tsx "leaves a 403 owner_only denial to the inline error alone"
Reader: src/kiro_crew/dashboard/handlers/portability.py:api_portability_export -- crew page -- the machine owner still gets past the gate; test_the_owner_still_reaches_the_portability_export_and_import
Reader: src/kiro_crew/dashboard/handlers/portability.py:api_portability_import -- crew page -- the machine owner still gets past the gate; test_the_owner_still_reaches_the_portability_export_and_import
Reader: src/kiro_crew/dashboard/handlers/portability.py:api_portability_preview -- crew page -- asks no owner gate, so nothing changes for anyone; test_api_portability.py
Reader: src/kiro_crew/dashboard/kiro_relay/limits.py:remote_route_limit -- release -- not edited, so a relayed remote caller's route boundary is unchanged; test_kiro_relay_caller_identity.py
Tests
test_the_portability_export_and_import_stay_the_owners: for an SSM invite guest, a Tailscale collaborator and a relay teammate,GET /api/portability/export(with and without a query, and with a trailing slash) andPOST /api/portability/import(merge andmode=replace) are owner-only, the owner gate refuses them, and the machine owner still passes.test_a_teammate_is_refused_the_portability_export_and_import: through the real handlers, each teammate gets 403owner_onlyfrom both routes and never reaches the export planner or the upload reader.test_the_owner_still_reaches_the_portability_export_and_import: the machine owner gets past the gate into both handlers (control; passes with and without the fix).teammate_access.pychange reverted, the 18 teammate cases fail and the owner control passes.test/test_shared_crew_*.py, everytest/test_*portability*.py,test_kiro_relay_caller_identity.py,test_members_roster_relay_teammate.py,test_multipart_routes_wrong_body.pyandtest_snapshot_memory_stores.py(103 files): 2466 passed, 9 skipped.Proof: PROVEN test/test_shared_crew_teammate_owner_access.py::test_the_portability_export_and_import_stay_the_owners[ssm-GET-/api/portability/export], test/test_shared_crew_teammate_owner_access.py::test_the_portability_export_and_import_stay_the_owners[ssm-GET-/api/portability/export?include_sessions=true], test/test_shared_crew_teammate_owner_access.py::test_the_portability_export_and_import_stay_the_owners[ssm-GET-/api/portability/export/], test/test_shared_crew_teammate_owner_access.py::test_the_portability_export_and_import_stay_the_owners[ssm-POST-/api/portability/import], test/test_shared_crew_teammate_owner_access.py::test_the_portability_export_and_import_stay_the_owners[ssm-POST-/api/portability/import?mode=replace] (head e824484)
Manual verification
N/A: unit coverage drives the real owner gate and both real handlers for each teammate shape and for the owner; the change is one table entry read by that gate.
Screenshots / video
N/A: the diff touches no frontend file.
Related Issues
Part of #38188
Sibling sweep
Swept: git grep -nE "require_owner_dashboard_request|require_owner_for_dashboard_caller|is_owner_dashboard_request|_authorize_owner_request" -- src/ (the routes that hand back stored config or secret values)
Sibling: src/kiro_crew/dashboard/handlers/core_config_view.py:128 -- not affected -- GET /api/config/kirocrew masks every sensitive value for every reader, the owner included
Sibling: src/kiro_crew/dashboard/messaging_api/slack_settings.py:103 -- not affected -- a channel config read returns masked token previews, and its writes are already in CHANNEL_CONNECTION_WRITES
Sibling: src/kiro_crew/crewmate_bundle_export.py:219 -- not affected -- the member export replaces every MCP env, headers and clientSecret value with a placeholder
Sibling: src/kiro_crew/dashboard/kiro_relay/limits.py:120 -- not affected -- the vault, local tokens and app secrets are already owner-only for teammates through remote_route_limit
Pattern harvest
Rule candidate: review-prompt
Pattern: a gate that widens from an allow-list to "everything except a deny-list" must sweep every route the old gate held for raw credential reads and ceiling writes, and add each to the deny-list in the same change.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.