Skip to content

Cover Saxon's unparsed-text family and json-doc on the TrAX path - #71

Merged
garydgregory merged 2 commits into
apache:mainfrom
ppkarwasz:tests/saxon-trax-external-calls
Sep 1, 2026
Merged

Cover Saxon's unparsed-text family and json-doc on the TrAX path#71
garydgregory merged 2 commits into
apache:mainfrom
ppkarwasz:tests/saxon-trax-external-calls

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

Saxon's XPath 3.1 unparsed-text, unparsed-text-lines, unparsed-text-available and json-doc do not go through the JAXP URIResolver that governs document() and xsl:include/xsl:import: Saxon routes them through the Configuration's resource resolver. SaxonXPathExternalCallsTest covers that chain on the XPath path, where the floor sits on the Configuration directly, but the stylesheet side had no equivalent — the TrAX path installs its floor through the factory wrapper's setURIResolver, and nothing verified that the two routes meet.

They do. This adds the TrAX companion test, and no production change is needed:

  • unparsed-text, unparsed-text-lines, json-doc — checked as leak pairs. An unconfigured Saxon factory resolves the URI and copies the marker into the transform output (control, proving the vector is real); the secured factory does not. Saxon reports FOUT1170 Resolver for unparsed-text() returned non-StreamSource, i.e. the floor is consulted for the text-nature request and answers with EmptySource.
  • unparsed-text-available — discloses no content, so it is checked as an existence oracle: the unconfigured factory distinguishes an existing fixture from a missing sibling, and the secured factory must not.

Saxon is instantiated reflectively behind an assumeSaxonPresent() guard, following SaxonAlternateFactoryTest, so the class is effective on the test-saxon and test-saxon-xerces executions (7 run, 0 failures) and skips on the four executions without Saxon. Full matrix green.

🤖 Generated with Claude Code

ppkarwasz and others added 2 commits September 1, 2026 11:01
The XPath 3.1 unparsed-text functions and json-doc do not go through
the JAXP URIResolver that governs document() and xsl:include; Saxon
routes them through the Configuration's resource resolver. Only the
XPath path had tests for that chain, leaving the stylesheet side of it
unverified even though the factory wrapper's floor already covers it.

Add the TrAX companion of SaxonXPathExternalCallsTest: the three
content functions are checked as leak pairs (unconfigured Saxon copies
the marker into the output, the secured factory does not), and
unparsed-text-available as an existence oracle the secured factory must
not answer from the real filesystem. No production change: the secured
factory already blocks every one of these.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CLnTBsvmYtxzNTWVGNyz33
@garydgregory
garydgregory merged commit 8067483 into apache:main Sep 1, 2026
16 checks passed
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