PaymentTransport can pay attacker-controlled challenges after cross-origin redirects
Description
In pympp 0.10.0 and earlier, PaymentTransport did not verify that a payment challenge came from the origin the caller originally requested. When redirect following was enabled, a cross-origin redirect could lead to an attacker-controlled origin that returned a 402 Payment Required challenge. The transport would create a fresh Authorization: Payment credential for that challenge, even though httpx had removed authorization credentials while crossing origins.
Impact
An attacker who can control the redirect target can choose the challenge's payment amount and recipient, potentially diverting a payment to the attacker. This requires redirect following to be enabled and the attacker to control the redirect destination, such as through an open redirect on a trusted service or influence over the requested URL.
The default Client configuration uses httpx's default follow_redirects=False and is not affected. The vulnerable behavior is reachable through per-request follow_redirects=True and through a custom httpx.AsyncClient configured with PaymentTransport and follow_redirects=True.
Patches
Upgrade to pympp 0.10.1 or later. The transport now records the request's original origin and refuses a payment challenge reached through a redirect that changes the scheme, host, or port. The check occurs before credential creation, so no payment authorization is sent to the redirected origin.
Workarounds
If upgrading is not immediately possible, leave redirect following disabled or handle redirects manually and validate the destination origin before issuing a new request.