Repository navigation
Conversation
XML::LibXML allows network access during XML parsing by default, which is a security concern even when expand_entities and load_ext_dtd are disabled. This adds an opt-in build-time prompt so distributors and end-users can choose secure defaults. Mechanism: - Makefile.PL prompts "Enable no_network by default?" (default: n) - XML_LIBXML_DEFAULT_NONET=1 env var skips the prompt for automation - Answering "y" adds -DLIBXML_DEFAULT_NONET to the compile flags - New XS function DEFAULT_NONET() exposes the build-time choice - LibXML.pm conditionally ORs XML_PARSE_NONET into parse defaults Also fixes _html_options() to unconditionally default HTML parsing to NONET (the old !$self->no_network fallback was a fragile hack that inverts when the XML default flips). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
How? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in build-time prompt to
perl Makefile.PLthat lets users/packagers enableno_network => 1as the default for all XML::LibXML parsers, readers, and schema validators.Why
GH #43: XML::LibXML allows network access during XML parsing by default. Even with
expand_entitiesandload_ext_dtddisabled, network fetches can still occur. This is a security concern, but changing the default unconditionally would break existing code. The prompt approach lets users choose.How
prompt()asks "Enable no_network by default?" (default: n).XML_LIBXML_DEFAULT_NONET=1env var skips the prompt for automated builds. Answering yes adds-DLIBXML_DEFAULT_NONETto compile flags.PERL_MM_USE_DEFAULT=1(CPAN smokers) gets the safe default of "n".DEFAULT_NONET()function exposes the compile-time flag.XML_PARSE_NONETinto$XML_LIBXML_PARSE_DEFAULTSwhen the flag is set.!$self->no_networkfallback was a hack that inverts when the XML default changes. Replaced with unconditional1— HTML always defaults to NONET, which was always the intent. Only explicit method-levelno_network => 0disables it.Testing
-DLIBXML_DEFAULT_NONETt/43options.tupdated to handle conditional defaultDEFAULT_NONET()returns correct value in both builds$parser->no_network()returns 1 when built with the flag, 0 otherwiseno_network => 0opt-out works in both buildsCloses #43
🤖 Generated with Claude Code
Quality Report
Changes: 8 files changed, 63 insertions(+), 15 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline