Repository navigation
fix(knowledge): require a direct local request for the native folder picker - #14629
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Raw TCP tunnels (ssh -L) add no forwarding header and still pass the gate — confirm that known helper limit is an accepted residual here. [DESIGN-REVIEWED] f33e2b0 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS One counted sibling left unfixed: Not justified as shipped
What this change shipsInventory (2 items) — 1 justifiedIntent: stop the knowledge folder picker's native macOS dialog from opening on the operator's screen for proxied/remote requests — a FIX.
[FIRST-PRINCIPLES-REVIEWED] f33e2b0 |
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: |
d4c5695 to
4c085b7
Compare
4c085b7 to
0935479
Compare
…picker local_only describes how the gateway was started, not where the request came from. A same-host tunnel or reverse proxy delivers a remote user's request from a loopback peer with local_only still True, so the native folder dialog would open on the gateway operator's screen. Require a direct local request too, matching the sibling project picker in handlers/files.py. Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com>
0935479 to
f33e2b0
Compare
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: |
…release/0.8.0 (#15631) * fix(security): backport the MCP registry, config seal, cron brace and folder-picker fixes (#14629, #14748, #14486, #15344) Backport of #14629, #14748, #14486, #15344 to release/0.8.0, cherry-picked in main's merge order. * fix(knowledge): require a direct local request for the native folder picker (#14629) (cherry picked from commit a25b321) * fix(security): write-protect the kiro-cli MCP registry (#14748) (cherry picked from commit d55957e) * fix(sandbox): mount config.json and config.local.json read-only (#14486) (cherry picked from commit 909e0fc) * fix(cron): scan every nested shell level and resolved assignments for braces (#15344) (cherry picked from commit 481476a) Co-authored-by: Joe Guo <zejiangg@amazon.com> Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com> Co-authored-by: Leon <leon.lai.yc@gmail.com> * fix(security): backport the apps-tree cron mask, listener-scoped credentials and dev-fleet git hardening (#13273, #13929, #14960, #13348) Backport of #13273, #13929, #14960, #13348 to release/0.8.0, cherry-picked in main's merge order. * fix(cron): mask the apps tree from every cron child that runs model-supplied code (#13273) (cherry picked from commit 0496784) * fix(electron): scope the local-token mint to the dialed listener (#13929) (cherry picked from commit 497361d) * fix(instances): pair the internal-API credential read with the dialed listener (#14960) (cherry picked from commit 2087cde) * fix(dev-fleet): harden every git read, and resolve the base branch per repository (#13348) (cherry picked from commit 64b0a33) Co-authored-by: kirocrew-agent <agent@kirocrew.local> Co-authored-by: wave1 verify <worker@localhost> --------- Co-authored-by: Joe Guo <zejiang.guo@gmail.com> Co-authored-by: Joe Guo <zejiangg@amazon.com> Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com> Co-authored-by: Leon <leon.lai.yc@gmail.com> Co-authored-by: Raymond Chen <45910466+chenmingwei23@users.noreply.github.com> Co-authored-by: kirocrew-agent <agent@kirocrew.local> Co-authored-by: wave1 verify <worker@localhost>
Problem / Motivation
Goal: Stop the native macOS folder picker from opening on the gateway operator's screen when a remote user reaches the dashboard through a same-host proxy or tunnel.
The knowledge picker offers a native folder dialog when the gateway runs on macOS and was started local-only. But
local_onlyonly says how the gateway was started, not where the request came from. The gateway binds loopback, and remote access is delivered by a same-host tunnel or reverse proxy, so a remote user's request still arrives from127.0.0.1withlocal_onlyTrue. The dialog then opens on the operator's machine, not the requester's, and blocks there.Why it matters
A remote user who clicks the picker hangs a modal on someone else's screen for up to the dialog timeout, and their own request stalls. The same helper guards the project picker in
handlers/files.py, so the knowledge picker should match it.Not a goal
What changed (motivation → approach → change)
A remote user behind a same-host proxy could trigger the native folder dialog on the gateway operator's screen, because the picker only checked
local_onlyand the macOS binary.The origin of the request was never checked. A proxied request arrives from a loopback peer but carries a forwarding header; a direct browser does not.
_folder_picker_availableinsrc/kiro_crew/dashboard/handlers/knowledge.pynow also requiresis_direct_local_request, the same helper the project picker uses. A proxied request fails the gate and the picker is hidden, so the dashboard falls back to the typed-path route.test/test_knowledge_add_source.pycovers the new cases.Backwards compatibility
Compatible: the gate only becomes stricter for proxied requests that should never have reached a host-side dialog; a direct local macOS request is unchanged.
Tests
test_unavailable_when_a_proxy_forwarded_the_request— a loopback request with a forwarding header fails the gate.test_unavailable_when_the_peer_is_not_loopback— a non-loopback peer fails the gate.test_the_forwarding_header_is_what_flips_it— two requests differing only by the forwarding header flip the result, so the guard is what decides._fake_requestfixture now carriesremoteandheadersso the real predicate is exercised rather than a mock of itself.Manual verification
N/A — unit coverage exercises the real
is_direct_local_requestpredicate across the direct, proxied, and non-loopback cases.Screenshots / video
Why no screenshot: backend request-origin gate only; no rendered UI change.
Pattern harvest
Not generalizable: this re-applies an existing project pattern -- the direct-local-request gate the sibling project picker already uses in
handlers/files.py-- to one more picker that lacked it. There is no new rule to harvest; the sibling was already correct.Supersedes #9358.
Co-authored-by: leonlaiyc <276034861+leonlaiyc@users.noreply.github.com>