Skip to content

fix(reliability): remove ambient HTTPX Connection default - #195

Draft
seonghobae wants to merge 6 commits into
mainfrom
fix/public-client-default-headers-current-main
Draft

fix(reliability): remove ambient HTTPX Connection default#195
seonghobae wants to merge 6 commits into
mainfrom
fix/public-client-default-headers-current-main

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Purpose

Fix #194 at the public EgressWeave client-construction boundary without weakening the strict hop-by-hop request-header validator. This PR is also the required predecessor for Draft #193's response-cookie-state repair.

Exact current identity

  • protected/live base: 7faf7a3b8a47980113982914000e724ab6a6cda5;
  • exact current head: 5abc442bb4269c2bdce74cd870bfc9889c70be89;
  • state: open / Draft / mergeable;
  • ancestry: 6 commits ahead / 0 behind exact protected main;
  • current main-relative scope is exactly src/egressweave/sync_transport.py, src/egressweave/transport.py, and tests/test_public_client_default_headers.py.

Historical checks, reviews, comments, base snapshots and generated merge revisions from predecessor heads do not transfer.

RCA and narrow fix

HTTPX adds an ambient Connection client default. EgressWeave correctly rejects hop-by-hop request headers at its transport boundary, so an ordinary policy-allowed request built through the public client could deny itself before pinned-pool dispatch unless the caller manually removed that framework default.

The narrow repair removes only HTTPX's ambient Connection default when EgressWeave constructs its synchronous/asynchronous public clients. Caller-supplied hop-by-hop fields remain fail-closed at the existing strict transport validator. Destination authorization, normalized (hostname, port), method/target/framing policy, redirects, proxies, Unix sockets, TLS identity, DNS pinning/revalidation, credentials, finite resource budgets and cleanup remain unchanged.

Focused regressions require an ordinary allowed request to reach the injected pinned pool without caller surgery, require the final low-level request to omit ambient hop-by-hop controls, and retain denial of caller-supplied forbidden fields.

Exact-current-head evidence

On unchanged 5abc442bb4269c2bdce74cd870bfc9889c70be89:

  • repository CI run 31596370532: completed success;
  • SAST Semgrep run 31596370551: completed success;
  • Security Scan run 31596370786: aggregate success, but dependency-review job 94112774879 shows the actual immutable-pinned Dependency review action as skipped; wrapper green is therefore non-passing supply-chain evidence;
  • OpenCode required check 94121293201: completed success, but check/model evidence is not promoted into a formal approval;
  • Noema check 94112774229: completed success as separate machine/model evidence;
  • Strix exact-head check 94112774246: wrapper success with annotation Strix backend unavailable and no vulnerability report; this is non-passing semantic security evidence under security: fail closed when required Strix review is unavailable #197;
  • formal reviews: none;
  • unresolved review threads: none.

The PR was returned to Draft because its exact current head is not merge-acceptable despite green wrappers. No source head was churned to retrigger external providers.

Read-only central prerequisites

Dependency Review and Strix fail-closed result semantics are organization-owned. The current Dependency Review repair remains separately governed as ContextualWisdomLab/.github#897; Strix no-report/unavailable semantics are tracked centrally by .github#891 and locally by #197. .github is read-only from this EgressWeave writer. Do not create an EgressWeave-local substitute, weaken either gate, invent credentials, duplicate the workflows, or mutate this clean source head solely to retrigger provider behavior.

Remaining acceptance

  1. Integrate a freshly verified protected-central Dependency Review repair, then obtain fresh unchanged-tree Security Scan evidence where the actual immutable-pinned Dependency Review action executes and succeeds.
  2. Obtain an actual exact-head Strix semantic report under the corrected central fail-closed path; backend-unavailable/no-report/wrapper-only evidence does not pass.
  3. Validate every current human/automated finding against this unchanged head and resolve only addressed threads.
  4. Immediately before integration, refetch exact head, independently resolved live base, ancestry, live ruleset, all required workflows, reviews/findings/threads and writer evidence.
  5. Merge only the unchanged accepted tree under live governance. The currently observed ruleset requires review-thread resolution and zero approving reviews, so do not manufacture approval.
  6. After protected integration, retarget/reconstruct test(security): reproduce response-driven cookie persistence #193 on the resulting exact protected base and regenerate all base-sensitive evidence; no fix(reliability): remove ambient HTTPX Connection default #195 evidence transfers.

Progresses #194; predecessor of #193/#134.

Summary by CodeRabbit

  • 개선 사항

    • 동기·비동기 HTTPS 요청에서 불필요한 Connection 헤더가 자동으로 제거됩니다.
    • 리다이렉트와 환경 프록시 설정을 사용하지 않는 일관된 연결 동작이 적용됩니다.
    • 허용 및 거부된 주소 모두에서 DNS 고정 연결 방식이 안정적으로 유지됩니다.
  • 버그 수정

    • 일반 GET 요청 시 불필요한 홉바이홉 헤더가 포함되지 않도록 검증을 강화했습니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6f0a0b5-5e9b-4e4b-b8d0-823a8a209869

📥 Commits

Reviewing files that changed from the base of the PR and between 7faf7a3 and 5abc442.

📒 Files selected for processing (3)
  • src/egressweave/sync_transport.py
  • src/egressweave/transport.py
  • tests/test_public_client_default_headers.py

📝 Walkthrough

Walkthrough

동기 및 비동기 HTTPX 클라이언트 생성 로직을 공통 헬퍼로 통합했습니다. 헬퍼는 리다이렉트를 비활성화하고 환경 설정을 무시하며 기본 Connection 헤더를 제거합니다. 동기·비동기 공개 클라이언트의 헤더 정책을 회귀 테스트로 검증합니다.

Changes

HTTPX 헤더 정책

Layer / File(s) Summary
비동기 클라이언트 생성 경로
src/egressweave/transport.py
비동기 클라이언트가 공통 헬퍼를 사용합니다. 헬퍼는 리다이렉트를 비활성화하고 환경 프록시를 무시하며 기본 Connection 헤더를 제거합니다. 거부 전용 클라이언트와 핀 고정 transport 클라이언트도 이 경로를 사용합니다.
동기 클라이언트 생성 경로
src/egressweave/sync_transport.py
동기 클라이언트가 공통 헬퍼를 사용합니다. 헬퍼는 기본 Connection 헤더를 제거합니다. 거부 전용 클라이언트와 DNS 고정 클라이언트가 이 경로를 사용하며 요청·응답 제한 동작이 문서화되었습니다.
기본 헤더 회귀 검증
tests/test_public_client_default_headers.py
동기 및 비동기 공개 클라이언트가 connection, keep-alive, 프록시 인증 관련 헤더 및 upgrade를 전송하지 않는지 검증합니다. 요청 전달, 204 응답 및 클라이언트 종료도 확인합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • EgressWeave 194: 공통 동기·비동기 클라이언트에서 HTTPX의 기본 Connection 헤더를 제거하는 변경과 회귀 테스트가 이 이슈의 목표와 일치합니다.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 HTTPX의 ambient Connection 기본값 제거라는 변경의 핵심을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/public-client-default-headers-current-main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae seonghobae changed the title test(reliability): reproduce public client default-header self-denial fix(reliability): remove ambient HTTPX Connection default Aug 12, 2026
@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 09:11
@seonghobae
seonghobae marked this pull request as draft August 12, 2026 21:08
@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 23:21
@seonghobae
seonghobae marked this pull request as draft August 12, 2026 23:48

Copy link
Copy Markdown
Contributor Author

@coderabbitai review exact head 5abc442bb4269c2bdce74cd870bfc9889c70be89; verify ambient HTTPX Connection removal without weakening caller-supplied hop-by-hop denial.

Copy link
Copy Markdown
Contributor Author

@opencode-agent review exact head 5abc442bb4269c2bdce74cd870bfc9889c70be89 and submit a formal current-head verdict on public-client defaults, transport-header integrity, and sync/async parity.

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review independently review exact head 5abc442bb4269c2bdce74cd870bfc9889c70be89 after a qualifying primary verdict and submit a formal current-head decision.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Checked-out commit =='
git rev-parse HEAD
echo

echo '== Exact commit metadata =='
git show -s --format='%H%n%P%n%s' 5abc442bb4269c2bdce74cd870bfc9889c70be89
echo

echo '== Changed files at requested commit =='
git diff-tree --no-commit-id --name-status -r 5abc442bb4269c2bdce74cd870bfc9889c70be89
echo

echo '== Commit diff =='
git show --format= --find-renames --find-copies 5abc442bb4269c2bdce74cd870bfc9889c70be89 -- \
  src/egressweave/sync_transport.py \
  src/egressweave/transport.py \
  tests/test_public_client_default_headers.py
echo

echo '== Structure of changed Python files =='
ast-grep outline src/egressweave/sync_transport.py --items all --type class,function
ast-grep outline src/egressweave/transport.py --items all --type class,function
ast-grep outline tests/test_public_client_default_headers.py --items all --type class,function
echo

echo '== Header validation and HTTPX client construction references =='
rg -n -C 5 -i \
  'hop[-_ ]by[-_ ]hop|forbidden.*header|header.*forbidden|connection|httpx\.(Client|AsyncClient)\s*\(' \
  src/egressweave tests

Length of output: 130398


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit='5abc442bb4269c2bdce74cd870bfc9889c70be89'
parent_one="$(git rev-parse "${commit}^1")"
parent_two="$(git rev-parse "${commit}^2")"

echo '== Per-parent changes in merge commit =='
echo "-- Diff from first parent: ${parent_one} --"
git diff --stat "${parent_one}" "${commit}"
git diff --find-renames --find-copies "${parent_one}" "${commit}" -- \
  src/egressweave/sync_transport.py \
  src/egressweave/transport.py \
  tests/test_public_client_default_headers.py
echo
echo "-- Diff from second parent: ${parent_two} --"
git diff --stat "${parent_two}" "${commit}"
git diff --find-renames --find-copies "${parent_two}" "${commit}" -- \
  src/egressweave/sync_transport.py \
  src/egressweave/transport.py \
  tests/test_public_client_default_headers.py
echo

echo '== Sync builder and transport dispatch =='
sed -n '220,380p' src/egressweave/sync_transport.py
echo

echo '== Async builder and transport dispatch =='
sed -n '380,530p' src/egressweave/transport.py
echo

echo '== Header safety implementation =='
sed -n '1,240p' src/egressweave/request_safety.py
echo

echo '== New default-header regression tests =='
cat -n tests/test_public_client_default_headers.py
echo

echo '== Existing protocol-switching regression tests =='
cat -n tests/test_protocol_switching_header_safety.py
echo

echo '== Public-builder forbidden-header test references =='
rg -n -C 4 \
  '(build_egress_sync_client|build_egress_http_client|build_pinned_https_client|build_pinned_https_async_client).*(headers|Connection|Keep-Alive|Upgrade|Proxy-)' \
  tests || true

Length of output: 44638


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Pull request metadata =='
gh pr view 195 --repo ContextualWisdomLab/EgressWeave \
  --json number,state,baseRefName,baseRefOid,headRefName,headRefOid,mergeCommit,url \
  --jq '.'
echo

base="$(gh pr view 195 --repo ContextualWisdomLab/EgressWeave --json baseRefOid --jq '.baseRefOid')"
head='5abc442bb4269c2bdce74cd870bfc9889c70be89'

echo "== Full PR diff: ${base}...${head} =="
git diff --stat "${base}" "${head}"
git diff --name-status "${base}" "${head}"
git diff --check "${base}" "${head}"
echo

echo '== HTTPX client constructors in the PR range =='
git diff -U12 "${base}" "${head}" -- \
  src/egressweave/sync_transport.py \
  src/egressweave/transport.py \
  tests/test_public_client_default_headers.py
echo

echo '== All current caller paths into request-header validation =='
rg -n -C 8 \
  '_build_safe_request_headers\s*\(|safe_headers\s*=\s*_build_safe_request_headers' \
  src/egressweave/sync_transport.py \
  src/egressweave/transport.py \
  src/egressweave/request_safety.py
echo

echo '== Repository test configuration and dependency pins =='
fd -a '^(pyproject\.toml|tox\.ini|pytest\.ini|requirements.*\.txt|uv\.lock|poetry\.lock)$' . \
  -x sh -c 'echo "--- $1"; sed -n "1,220p" "$1"' sh {}

Length of output: 26688


@seonghobae Reviewed PR #195 at exact head 5abc442bb4269c2bdce74cd870bfc9889c70be89.

No findings in the requested scope.

  • Both public client helpers remove only HTTPX’s ambient Connection default with client.headers.pop("connection", None).
  • The synchronous and asynchronous transports still send request.headers.raw through _build_safe_request_headers before connection-pool dispatch.
  • That boundary still rejects caller-supplied Connection, Keep-Alive, Proxy-Authenticate, Proxy-Authorization, Proxy-Connection, and Upgrade fields.
  • Existing sync and async regression tests verify these fields fail before pool dispatch.
  • The new regression tests verify ordinary requests reach the injected pinned pool with no ambient hop-by-hop fields.
  • Redirect disabling, environment isolation, and injected transport use remain unchanged.
  • git diff --check reported no whitespace errors.

I did not execute repository code or tests because this review environment permits static inspection only.

You are interacting with an AI system.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current-head source review for 5abc442bb4269c2bdce74cd870bfc9889c70be89 found no blocking defect in the three-file public-client-default scope. The helper removes only HTTPX's ambient case-insensitive Connection default after constructing each sync/async client, keeps caller-supplied hop-by-hop fields subject to the existing strict transport rejection, and uses injected pinned-pool regressions to prove ordinary requests reach dispatch without widening authority, proxy, redirect, DNS, TLS, framing or resource policy. This is author-side review evidence only, not independent approval. Keep Draft until the corrected central Dependency Review and Strix evidence paths produce substantive exact-head results and independent review is present.

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review review

Review exact current head 5abc442bb4269c2bdce74cd870bfc9889c70be89 against protected main@7faf7a3b8a47980113982914000e724ab6a6cda5. Validate that only HTTPX's ambient Connection default is removed at public sync/async client construction, caller-supplied hop-by-hop fields remain fail-closed, and authority, DNS pinning/revalidation, TLS, proxy, redirect, target/framing, request/response budgets and cleanup remain unchanged. Submit a formal independent verdict only for this head. Do not mutate, merge, or infer acceptance from the old backend-unavailable Strix wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reliability: public pinned clients must not self-deny HTTPX default Connection header

1 participant