php-src/ext/soap
Niels Dossche 8f14f036c3
Sanitize libxml2 globals before parsing
Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().

(cherry picked from commit c283c3ab0b)
2023-07-31 23:21:56 +03:00
..
tests Merge branch 'PHP-8.1' into PHP-8.2 2023-05-09 19:52:52 +02:00
config.m4 Normalize comments in *nix build system m4 files 2019-05-12 18:43:03 +02:00
config.w32
CREDITS
php_encoding.c Use more compact representation for packed arrays. 2021-11-03 15:18:26 +03:00
php_encoding.h Move derefs into accessor macros 2021-08-20 14:15:23 +02:00
php_http.c Merge branch 'PHP-8.1' into PHP-8.2 2023-06-06 18:07:19 -04:00
php_http.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_packet_soap.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_packet_soap.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_schema.c Use more compact representation for packed arrays. 2021-11-03 15:18:26 +03:00
php_schema.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_sdl.c Reduce memory allocated by var_export, json_encode, serialize, and other (#8902) 2022-07-08 14:47:46 +02:00
php_sdl.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_soap.h Move derefs into accessor macros 2021-08-20 14:15:23 +02:00
php_xml.c Sanitize libxml2 globals before parsing 2023-07-31 23:21:56 +03:00
php_xml.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
soap.c Merge branch 'PHP-8.1' into PHP-8.2 2022-10-13 16:08:34 +02:00
soap.stub.php Declare ext/soap constants in stubs (#9124) 2022-07-25 16:40:41 +02:00
soap_arginfo.h Revert "Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs" 2023-07-04 09:11:14 +02:00