Skip to content

Fix GH-24315: Harden SoapClient cross-origin redirect handling - #24329

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-24315-soap-cross-origin-redirect
Open

iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-24315-soap-cross-origin-redirect

Conversation

@iliaal

@iliaal iliaal commented Oct 14, 2026

Copy link
Copy Markdown
Member

SoapClient followed any Location header and resent the HTTP authentication credentials, the stream context headers, and the SOAP envelope to whatever origin it named. Redirects to a different scheme, host, or port now fail with a SoapFault, except a same-host upgrade from http to https on port 443. The new follow_cross_origin_redirects SoapClient option restores the previous behavior for deployments that depend on it.

The issue notes that stripping credentials would still forward the envelope, so this rejects the redirect instead. That is stricter than the http stream wrapper used for WSDL fetches, which strips Authorization and Cookie on a cross-origin redirect (5af9465) and also counts http to https as cross-origin. Master only, since it changes behavior; UPGRADING carries the note.

Fixes #24315

SoapClient followed any Location header, so a redirect to another host,
port, or scheme resent the HTTP authentication credentials, the stream
context headers, and the SOAP envelope to that origin. Such redirects now
fail with a SoapFault. A same-host upgrade from http to https on port 443
is still followed. The new follow_cross_origin_redirects option restores
the previous behavior. Cookies were already scoped by domain and
Proxy-Authorization only reaches the proxy, so neither changes.

Fixes phpGH-24315
@iliaal
iliaal force-pushed the fix/gh-24315-soap-cross-origin-redirect branch from 79f3773 to 8982dd6 Compare October 15, 2026 12:01
GH-24315 (SoapClient follows redirects to a different origin)
--EXTENSIONS--
soap
openssl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it needed ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

soap just for completion really, not strictly needed,
openssl does have a purpose, the allowed HTTP-to-HTTPS upgrade case emits a missing-wrapper warning without OpenSSL. Catching SoapFault doesn't suppress it, so the test fails.

@iliaal
iliaal requested a review from devnexen October 15, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden SoapClient cross-origin redirect handling

2 participants