Repository navigation
feat(egress): upgrade plain HTTP to HTTPS for listed hosts - #411
Merged
Merged
Conversation
|
Assessment: Comment I found no correctness defect in the upgrade path. The one open point is scope: the credential refusal means this change does not fix the Review categories
Checks that held (each in one line):
The scope is tight, and the tests cover the decision and port behaviour well. |
zastrowm
approved these changes
Nov 12, 2026
zastrowm
left a comment
Member
There was a problem hiding this comment.
Aligned directionally but check the names
7 of 8 tasks
ferdingler
added a commit
that referenced
this pull request
Nov 12, 2026
…5740518 already joins continued lines
6 of 8 tasks
This was referenced Nov 12, 2026
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.
Description
Problem
On macOS, rustup checks certificates with the macOS platform verifier. That verifier cannot trust the box's per-run CA (the CA is an environment value, not in the keychain), so
rustup toolchain installin a box fails withOSStatus -26276(#344). Letting rustup skip the gateway would also drop the per-request decision and the credential swap for cargo and everything it starts, becausecargois rustup's proxy.Measured on macOS and Linux with a test-only gateway patch (rustup with
RUSTUP_DIST_SERVER):https://(today)-26276static.rust-lang.org:443http://, no upgradestatic.rust-lang.org:80http://, upgrade onstatic.rust-lang.org:443Solution
A new top-level
box.tomltable,[gateway], with one key:http://request to port 80 of a listed host is decided and sent ashttps://on port 443. Every other plain request is unchanged (unlisted host, or another port of a listed host).CONNECTto the host:net:connect(host and each pinned address) andhttp:requestsee port 443, and the decision records name port 443. A backend that matcheshost:443still re-routes it, as for aCONNECT.Host= the bare host.interceptedstaysfalseand the existing "a secret must ride TLS" refusal still applies: a credential-matched request to an upgraded host is refused with403.*wildcard, IP address, or other character is refused withinvalid Box configuration: `[gateway] upgrade_http` entry "<entry>" is not a host name: <reason>; ....Why a new
[gateway]table: no gateway-wide table exists today, and[egress.<name>]is a map of route names, so a list key cannot live there. The upgrade acts on the workload's hop before any route matches, so it is box-wide, not per route. Keys inside tables usesnake_case(box_dir,contain_egress,phantom_prefix).Interfaces that move:
box.toml: new[gateway] upgrade_http(twelfth key).four_inputs.rspins the key set; the argument that it is not a fifth input (policy still decides every upgraded request) is in its module doc and incrates/box/AGENTS.md.gatewayfield; a record that sets it is version 32 (UPGRADE_HTTP_RECORD_VERSION), so an older build refuses it.egress_gateway::MitmConfig: newupgrade_http: Vec<String>field (default empty). No new exported name.Docs:
docs/user/egress.md(new "Upgrade plain HTTP to HTTPS" section and error rows),docs/user/config.md(key table row and[gateway]section),docs/user/native-filesystem-policy.md(record version 32),docs/design/egress.md,crates/box/README.md,crates/egress-gateway/README.md, and a decision entry indocs/design/decisions.md(macOS platform verifiers cannot trust the per-run CA; the local hop is plain HTTP on the machine; rustup still checks each package's SHA-256 from its channel manifest).Related Issues
#344
Type of Change
New feature
Testing
Base:
a41332d(origin/main at the time of testing).connect::tests::only_port_80_of_a_listed_host_is_upgraded_to_443,l7::tests::an_upgraded_plain_request_speaks_tls_to_its_own_host,l7::tests::a_plain_host_header_omits_the_upstream_schemes_default_port,gateway::tests::an_entry_that_is_not_a_host_name_is_refused_with_its_reason,gateway::tests::a_host_name_is_accepted,config::tests::a_gateway_upgrade_entry_that_is_not_a_host_name_is_refused_at_load,config::tests::the_gateway_upgrade_list_parses_and_is_empty_by_default,config::tests::the_gateway_upgrade_list_cannot_hide_in_a_legacy_record.interception_e2e.rs):a_listed_plain_request_is_decided_and_dialed_on_443(listed host decided, resolved and dialed on 443; unlisted host and port 8080 keep their port),a_listed_plain_request_reaches_a_tls_upstream_judged_on_443,a_credential_on_an_upgraded_plain_request_is_refused. With the upgrade disabled infirst_request, all three fail.static.rust-lang.org, policy permits onlystatic.rust-lang.org:443):http://, upgrade on200net:connectandhttp:requeston 443, permithttp://, no upgrade403net:connecton 80, no permit matchedhttps://, upgrade on200http://…:8080, upgrade on403net:connecton 8080, no permit matchedGates:
cargo fmt --all --check;cargo clippy --workspace --all-targets --all-features -- -D warningswith the justfile's allow list;cargo clippy -p strands-box-egress-gateway --all-targets --all-features -- -D warnings;cargo build -p strands-box-egress-gateway --no-default-features;RUSTDOCFLAGS="-D warnings" cargo doc -p strands-box-egress-gateway --all-features --no-deps;cargo test -p strands-box-egress-gateway --all-features(all pass);cargo test -p strands-box --all-features --no-fail-fast(1505 pass). Three box tests failed only under the full parallel run and pass alone:mcp_alias_fallback(Text file busywhen run in parallel; passes with--test-threads=1) andruntime_mcp_policy_staging::catalog_page_limit_accepts_256_pages_and_refuses_a_257th(MCP client timeout under load). This change touches neither.cargo test -p strands-box-egress-gateway --all-features,cargo test -p strands-box --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsNot covered
host:443. The no-backend TLS choice is covered by the unit test and by the manual Linux run against the real host.RUSTUP_HOME, which is outside this change.[gateway] upgrade_httpis box-wide; there is no per-tool scope.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.