Skip to content

Fix readFile bypass for https urls in Xml::build() - #87

Merged
kamilwylegala merged 1 commit into
kamilwylegala:masterfrom
iglocska:fix-xml-build-https-readfile
Sep 18, 2026
Merged

kamilwylegala merged 1 commit into
kamilwylegala:masterfrom
iglocska:fix-xml-build-https-readfile

Conversation

@iglocska

Copy link
Copy Markdown
Contributor

Xml::build() gates URL loading on the readFile option, but the condition is

  } elseif ($options['readFile'] && strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) {

&& binds tighter than ||, so this evaluates as (readFile && http) || (https). The https://
branch is never gated, and Xml::build($input, array('readFile' => false)) still performs an
outbound request.

The condition read

    $options['readFile'] && strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0

and && binds tighter than ||, so the https branch was never gated by the
option: Xml::build($input, array('readFile' => false)) still went out and
fetched an input beginning with https://. Only the http:// branch was
actually disabled.

RequestHandlerComponent passes readFile => false when it decodes an XML
request body, so an application that accepts XML input can be made to
issue an outbound https request to a host of the caller's choosing.

Parenthesised so both schemes are gated as the option intends, and the
existing readFile url test gains its https twin.
@kamilwylegala
kamilwylegala merged commit b024bc1 into kamilwylegala:master Sep 18, 2026
4 checks passed
@kamilwylegala

Copy link
Copy Markdown
Owner

Thanks @iglocska for your contribution 🙌

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.

2 participants