Skip to content

GH-23686: SOAP: redact more headers by default, add keep_headers option - #23698

Open
DanielEScherzer wants to merge 4 commits into
php:PHP-8.6from
DanielEScherzer:WSDL-credentials
Open

DanielEScherzer wants to merge 4 commits into
php:PHP-8.6from
DanielEScherzer:WSDL-credentials

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Member

No description provided.

@DanielEScherzer

Copy link
Copy Markdown
Member Author

@php/release-managers-86 can you please let me know if this needs to be in by the branch cut? I'm unsure if this counts as a new feature that would be blocked by the feature freeze - it adds more options, but the motivation is to allow opting out of the bug fix

@DanielEScherzer

This comment was marked as resolved.

@DanielEScherzer

This comment was marked as resolved.

Comment thread ext/soap/tests/gh23686/check_headers.inc Outdated
@svpernova09

Copy link
Copy Markdown
Contributor

@mbeccati and I agree this can go into 8.6

@DanielEScherzer
DanielEScherzer changed the base branch from master to PHP-8.6 September 28, 2026 04:38
@DanielEScherzer
DanielEScherzer marked this pull request as ready for review September 28, 2026 04:38
@DanielEScherzer

Copy link
Copy Markdown
Member Author

This should be ready for review, ideally we should merge it in the next two weeks so that it is in RC3

Comment thread ext/soap/php_sdl.c
Comment thread ext/soap/php_sdl.c Outdated
@DanielEScherzer

Copy link
Copy Markdown
Member Author

Okay

hopefully should be ready for another round of review

Comment thread ext/soap/php_sdl.c Outdated
Comment thread ext/soap/php_sdl.c Outdated
redaction &= ~REDACT_COOKIE;
}
if (redaction == REDACT_NONE) {
zend_string_release(lc_headers);

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.

Suggested change
zend_string_release(lc_headers);
zend_string_release(lc_headers);
zend_string_release(flat_headers);

Comment thread ext/soap/php_sdl.c Outdated
Comment thread ext/soap/php_sdl.c Outdated
Comment thread ext/soap/php_sdl.c
@DanielEScherzer

DanielEScherzer commented Oct 3, 2026 •

Copy link
Copy Markdown
Member Author

If I'm reading the suggestions correctly, they are to handle headers that are stored as arrays properly - but the tests suggests that they are already handled?

Looks like this is because get_sdl() uses http_context_headers() which converts things from an array to a string when filtering out known headers, and that is only triggered if soap wants to add its own headers, able to trigger the failure with:

$context = stream_context_create([
  'http' => [
    // having a protocol here means that SOAP won't add it itself
    'protocol_version' => 1.1,
    'header' => [
      "X-Authorization: This should be kept",
      "Authorization: This should be removed",
      "X-Proxy-Authorization: This should also be kept",
      "Proxy-Authorization: This should also be removed",
      "X-Cookie: Last one to keep",
      "Cookie: Last one to remove",
    ]
  ],
]);

good catch - I hadn't addressed array headers originally since on #23686 I was told that they could be ignored, but you're right that we should probably address them, done

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.

SoapClient only strips Authorization: Basic when a WSDL imports from another host

4 participants