Repository navigation
fix(kas): relay plain-http mcp headers again unless the operator opts out - #31064
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the PR puts back the behaviour users had before #30643 and makes the refusal an opt-in key. It takes nothing away from any reader, because Notes
[DESIGN-REVIEWED] 4990865 Description read[DESCRIPTION-READ] 9e99266a10be71e8b1611b1d0cf2383749c33bfba172a00b4d83d5ee062eb069 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. This puts back what worked before #30643, and the linked review 5795405137 asks for it. The new key defaults to off and has one consumer, What this change shipsInventory (6 items) — 6 justifiedIntent: let an operator's plain-
[FIRST-PRINCIPLES-REVIEWED] 4990865 Description read[DESCRIPTION-READ] d0148c8a780a67f3d7c4745c738a00a4a099a5b5c5451d0cbf0516b7ace2c660 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: |
bolichen97
left a comment
There was a problem hiding this comment.
Requesting changes on 0706946. This head does what the review on #30643 asked: the regex is gone (_normalized_host uses a plain character check and import re is removed), today's behavior is the default, and the refusal is an off-by-default key with tests for both states. One real defect is left.
bridgeable in kas_env_launch.py now tests url.lower().startswith(("https://", "http://")) on the raw string. kas_accepts_url and bridge_url both strip the url first, and the old bridgeable went only through kas_accepts_url. So an entry like " http://127.0.0.1:8080/mcp" with headers was bridged before and is not bridged on this head: its headers stay withheld and the server fails to authenticate. This matches the GPT lane finding at kas_env_launch.py:301, and I confirmed it in the diff. It fails closed, so nothing leaks, but it is a regression for a setup that works today.
Fix: strip the url once at the top of bridgeable (for example url = url.strip()) before the scheme check, so all three readers agree. A test with a leading space and headers on a loopback url and on another host would pin it.
Everything else looks right to me: the key reads only a JSON true, an unreadable config reads as off, the bad-port guard keeps one entry from stopping the batch, and the bridge keeps the environment proxy for plain http to another host as before.
I will look again when the head moves.
0706946 to
0a2c448
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Disposition for 0706946 -> fixed in 0a2c448. GPT 6.1 F1 / review 5795707660 (
|
0a2c448 to
f4a5e2b
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Disposition for 0a2c448 -> fixed in f4a5e2b. GPT 6.1 F1 (
|
… out #30643 stopped bridging an MCP server's headers to a plain http:// url on another host. That setup connected through Crew's bridge before, so it is restored by default, and the refusal moves behind agent.kas_refuse_plain_http_mcp_headers (off). The bridge bypasses environment proxies only for a loopback host, so a remote http server keeps its proxy route. The loopback host reading moves to the standard-library bridge, without a regex, so both sides share it.
f4a5e2b to
4990865
Compare
|
Holding 4990865 for human review. I found no concrete defect. Why it is held:
The code matches its description. The key reads only a JSON This clears when a maintainer accepts the cleartext-by-default policy and the change request is re-reviewed or dismissed. — crew-pr-reviewer (r147) |
bolichen97
left a comment
There was a problem hiding this comment.
Approving 4990865. The point from my earlier review is fixed.
What I checked on this head:
- All checks are green, including PR Readiness, CodeQL, Coverage Gate and Windows shard 8. The cancelled entries in the list are older duplicate runs, and each has a newer run that passed.
bridgeablenow strips the url once before the scheme check, so it reads the url the same way askas_accepts_urlandbridge_url.bridge_urlreturns the stripped url, because the launcher needs one that starts with the scheme. A new test covers a leading space andheaderson a loopback url and on another host.- The change from the last head I reviewed is small: this head also exports the help text constant for the new setting through the config module boundary. There is no other code change.
- No regex in the added product code. The earlier
re.fullmatchis gone andimport reis removed. - The default keeps today's behavior.
agent.kas_refuse_plain_http_mcp_headersis off unless it is a JSONtrue, so this adds no restriction.
I did not set auto-merge, because it is already set on this PR.
… out (#31064) #30643 stopped bridging an MCP server's headers to a plain http:// url on another host. That setup connected through Crew's bridge before, so it is restored by default, and the refusal moves behind agent.kas_refuse_plain_http_mcp_headers (off). The bridge bypasses environment proxies only for a loopback host, so a remote http server keeps its proxy route. The loopback host reading moves to the standard-library bridge, without a regex, so both sides share it. (cherry picked from commit f0d6dc0)
Problem / Motivation
Goal: On the KAS backend, an MCP server reached over plain
http://on another host withheadersconnects through Crew's bridge as it did before #30643, and refusing it is an opt-in setting.#30643 made Crew stop bridging an MCP server's
headersto a plainhttp://url on another host. That setup worked before: KAS refuses such a url itself, but it sees Crew's bridge as a local stdio server, so the server connected. After #30643 it no longer runs. Review 5795405137 on #30643 asks to keep today's behaviour by default and put the refusal behind a setting that is off, and to drop a new regex fromkas_env_launch.py.Why it matters
Users with such a server lost it on upgrade, with only a notice to explain why. A tightening like this should be the operator's choice, not a new default.
Not a goal
unkeyed-launch key, or the canonical loopback host the bridge dials. They stay as fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643 shipped them.What changed (motivation → approach → change)
Review 5795405137 on #30643, item by item:
_normalized_hostnow uses a plain character check (all(c in "0123456789abcdefx." for c in candidate)on a non-empty host) andimport reis gone. Same behaviour; the existing parity table (test_kas_accepts_url_matches_the_backends_rule) still passes. The function moved, unchanged apart from that line, fromacp/kas_env_launch.pyintokas_http_bridge.py, the standard-library leaf, andkas_env_launchimports it from there. The bridge needs the same loopback reading for its proxy rule (below), and the bridge cannot import the ACP stack.kas_env_launch.bridgeablebridges a plainhttp://url to another host again unlessagent.kas_refuse_plain_http_mcp_headersistrue(new, defaultfalse). With the key on, the server is not bridged and the session notice names it as not running, as in fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643. A url whose port does not parse is never bridged, so one bad entry cannot stop the batch.bridgeablestrips the url first, askas_accepts_urldoes, andbridge_urlreturns the stripped url on every branch, so the snapshot the launcher reads never keeps the spaces. The key is read at the point of use,kas_env_launch.refuses_plain_http_headers(KiroCrewConfig.load()when a session's projection runs). Only a JSONtrueturns it on; a config that cannot be loaded reads as off, which is today's behaviour.httphost, the case fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643 meant to fix. A plainhttpurl to another host keeps the environment proxy, as before fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643, since that may be its only route there.Kept from #30643: the not-run notice for servers KAS refuses, registry mode, the loopback host canonicalization for the bridge, and the random
unkeyed-launch key.Docs: the
security.mdrow,agent-spec-fields.mdandconfiguration.mddescribe the default and the new key.config-baseline.jsonregenerated. The help text lives insections_agent_fields.py(to keepsections_agent.pywithin its line budget), so theconfig.sectionsfacade and its inventory bind the new constant.builder-security checked: no listener is added or changed. The bridge is an outbound stdio-to-HTTP relay. The default restores the pre-#30643 behaviour for one url class, and the stricter behaviour is one config key away.
Backwards compatibility
Compatible: this restores what worked before #30643 (a header-bearing
http://server on another host connects through the bridge), and it adds one optional key that defaults to off. Nothing that works on main today stops working.Removes nothing: the only behaviour taken away is #30643's default refusal, which is now the opt-in key, and the new key adds a choice without hiding or renaming anything.
Tests
Proof: PROVEN test/test_kas_mcp_not_run_notice.py::test_a_loopback_bridge_never_goes_through_an_environment_proxy[http://127.1:9/mcp], test/test_kas_mcp_not_run_notice.py::test_a_loopback_bridge_never_goes_through_an_environment_proxy[http://0x7f000001/mcp], test/test_kas_mcp_not_run_notice.py::test_a_loopback_bridge_never_goes_through_an_environment_proxy[http://127.0.0.1./mcp] (head 4990865)
test/test_kas_mcp_not_run_notice.py:test_by_default_a_plain_http_server_with_headers_is_bridged_as_before: key off, the server goes through the bridge and no not-run entry is recorded.test_a_url_with_surrounding_space_is_bridged_like_the_other_readers: a url with surrounding spaces (loopback and another host) is bridged, becausebridgeablestrips it askas_accepts_urlandbridge_urldo.test_the_bridge_dials_the_canonical_loopback_host[...]: also covers" https://mcp.example/v1 "and" http://mcp.example/v1", whose snapshot url is stripped.test_with_the_refusal_on_it_is_not_bridged: key on, not bridged, namedinsecure-url.test_the_refusal_is_read_from_the_agent_config[...]: only a JSONtrueinconfig.jsonturns it on (true,false,"true", absent).test_a_loopback_bridge_never_goes_through_an_environment_proxy: also asserts a plainhttpurl to another host keeps the environment proxy.One mutation per guard, each reddened a named test: bridging despite the key (
test_with_the_refusal_on_it_is_not_bridged), refusing by default (test_by_default_..._bridged_as_before), the key always on (test_the_refusal_is_read_from_the_agent_config[False-False]), the loader dropping the key ([True-True]), the proxy bypass for every http host and for literal hosts only (test_a_loopback_bridge_never_goes_through_an_environment_proxy[http://127.1:9/mcp]), the bad-port guard (test_a_bad_port_on_one_server_does_not_stop_the_session), and the strip (test_a_url_with_surrounding_space_is_bridged_like_the_other_readers[ http://127.0.0.1:8080/mcp]).Run locally, single process:
test_kas_mcp_not_run_notice.py,test_kas_header_bridge.py,test_kas_env_launch.py,test_kas_withheld_credentials_notice.py,test_config_baseline.py,test_config_module_boundaries.py,test_config_refactor_contract.py-> 181 passed;test_sections_facade.py,test_facade_mirror_guards.py-> pass;test_config_load_pipeline_field_defaults.py,test_config_api.py,test_config_enum_coerced_keys.py,test_config_core_owned_sections.py-> 242 passed. black, isort, flake8, mypy (touched modules), comment-history, brand, harness parity, file line cap and docs lint pass.Manual verification
N/A — unit coverage sufficient: the change is which entries the projection bridges and which opener the bridge builds, and the tests assert both directly.
Related Issues
Follow-up to #30643, addressing review 5795405137 (#30643 (review)).
Sibling sweep
Swept: git grep -nE "kas_accepts_url|bridgeable(|ProxyHandler" -- src/kiro_crew
Sibling: src/kiro_crew/acp/kas_agents.py -- not affected -- its insecure-url record applies only to an entry left with a url and no command, so a bridged entry is never named
Sibling: src/kiro_crew/kas_http_bridge.py -- changed here
Pattern harvest
Not generalizable: a default that a fix tightened, put back behind an opt-in at a reviewer's request.
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.