security: route every HTTP client through one hardened builder (closes the config redirect leak) #709
No reviewers
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea!709
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/http-transport-chokepoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #708.
madtea built three HTTP clients independently, and only the gitea API client carried the redirect credential guard. The config bootstrap client kept its
Authorizationheader across a same-hosthttps -> httpdowngrade redirect, so the API token (onwhoamiand the pre-trust probes) and the OAuth token (on mint and the code-exchange POST) could leak in cleartext.This routes every client through one base-layer builder,
internal/httpx, which owns the redirect credential strip, the mutating-redirect stop, and the response body cap. Credential resolution stays ininternal/config. A parity gate test fails if any production file outsideinternal/httpxbuilds a rawhttp.Client, so the chokepoint cannot be bypassed.feat(httpx): the hardened client builder, with unit tests for the redirect policy (strip off-origin, stop a mutating redirect, cap hops) and the body cap.refactor(gitea): build throughinternal/httpx; its local copies deleted. The existing redirect, token-pin, and body-cap tests pass unchanged.fix(config): route the bootstrap client throughinternal/httpx, closing the leak across its three call sites. A test proves the token is stripped across an off-origin redirect.refactor(setup): route the connectivity probe throughinternal/httpx.test(parity): fail the gate on a raw HTTP client outsideinternal/httpx.docs(adr): proposed ADR 0049, grounded in ADR 0041 and ADR 0025 section 5.The only behavior change for a legitimate user is that a credential is stripped on a malicious downgrade or cross-origin redirect. The full gate passes.
ADR 0049 is proposed, not accepted: acceptance needs a second contributor's assent per ADR 0047.