Repository navigation
fix(kas): keep bridging header-bearing http:// MCP servers by default - #31164
Closed
iamwhatever wants to merge 1 commit into
Closed
iamwhatever wants to merge 1 commit into
iamwhatever wants to merge 1 commit into
Conversation
Answers bolichen97's review on #30643. - A header-bearing plain http:// server on another host is bridged again, as before #30643. The refusal moves behind agent.kas_mcp_http_loopback_only, off by default. The session notice still names servers that will not run, and the loopback host normalisation stays. - A bridge to another host keeps the environment proxy, as before; only a loopback http bridge ignores it. - _normalized_host uses a plain character check instead of a regex, so kas_env_launch needs no import re. It moves to kas_http_bridge, so the bridge's own loopback test reads the same rule. Refs #30630
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers bolichen97's review on #30643, which merged before the review landed.
Fixes #31160
Refs #30630
Problem / Motivation
Goal: keep today's header-bearing
http://MCP servers running onkasby default, with the #30643 refusal as an opt-in.#30643 stopped bridging a header-bearing plain
http://MCP server on another host, so on thekasbackend that server stopped running. Before #30643 it ran through Crew's local bridge. bolichen97 asked to keep that behavior by default and make the refusal opt-in. The review also asked to replace a new regex inkas_env_launch.pywith a plain check.Why it matters
A user whose MCP server is on another machine over plain
http://with a token header lost that server after upgrading, with no setting to get it back.Not a goal
What changed
kasbackend, a plainhttp://MCP server on another host that hasheadersruns again through Crew's local bridge, as before fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643. Its headers go unencrypted, as before, and it keeps using the environment proxy.agent.kas_mcp_http_loopback_onlytotrueand such a server does not run, and the session notice names it. Defaultfalse. The key is added toconfig-baseline.json.true, because the refusal is the safe side._normalized_hostnow usesall(c in "0123456789abcdefx." for c in candidate)plus a non-empty check, sokas_env_launch.pyhas noimport re. Same behavior:urlsplitlowercases the host. The function moved tokiro_crew/kas_http_bridge.py(standard library only), so the bridge's own loopback test uses the same rule.httphost, so a bridge to another host keeps the proxy as before.src/kiro_crew/docs/configuration.md(new row),src/kiro_crew/docs/agent-spec-fields.mdanddocs/system-specs/modules/security.mdnow describe the default and the opt-in.http://server to another host that is not bridged, and registry-mode servers. Loopback spellings (127.1,0x7f000001,127.0.0.1.) are still normalised, and a loopbackhttp://bridge still ignores environment proxies.Sibling sweep
Siblings: none --
bridgeableinsrc/kiro_crew/acp/kas_env_launch.pyis the one place that decides whether a remote server is bridged, and_openerinsrc/kiro_crew/kas_http_bridge.pyis the one place that sets the bridge's proxy.Tests
TestPlainHttpBridgedByDefault(setting off): the server is bridged and its snapshot holds the url. A server with no headers is still named. A bridge to another host keeps the proxy. The setting is read fromconfig.json, and a malformed value turns the refusal on.TestInsecureUrl(setting on): the fix(kas): name MCP servers KAS will not run, and relay env/headers without a session key #30643 refusal tests, unchanged.test_config_load_pipeline_field_defaults.py: the new key's malformed-value default istrue.loader_pipeline.pycoercion.mainin the agent sandbox:test_kas_bundle*,test_kas_route,test_config_loader_stt."true"read asfalse) is fixed in this commit, and a verifier confirmed it closed.Proof: PROVEN test/test_config_load_pipeline_field_defaults.py::TestAWrongTypedValueLoadsTheFieldDefault::test_every_field_of_the_section[agent], test/test_config_load_pipeline_field_defaults.py::test_each_read_stage_departure_names_a_field_and_differs_from_its_default, test/test_kas_mcp_not_run_notice.py::TestPlainHttpBridgedByDefault::test_a_plain_http_server_with_headers_is_bridged, test/test_kas_mcp_not_run_notice.py::TestPlainHttpBridgedByDefault::test_a_bridge_to_another_host_keeps_the_environment_proxy (head e962fc0)
Pattern harvest
Not generalizable: a review that landed after merge asked for a different default; the code had no defect to generalize.
Breaking: none. This restores the behavior from before #30643 by default.