Resolve each unresolved URI to a fresh empty document - #69
Merged
garydgregory merged 1 commit intoSep 1, 2026
Merged
Conversation
The URIResolver floor answered every unresolved reference with a DOMSource over one shared static Document; the Source escapes to the consumer, so a component mutating a document it received would surface its changes in every later resolution, process-wide. Follow the JDK's XSLTC pattern and build a fresh empty document per resolution, using the same secured, namespace-aware factory selection as the Source rewrite (an upgrade over the previous raw JAXP lookup, and it now honors overrideDefaultParser). Creation failure is wrapped in IllegalStateException per call instead of ExceptionInInitializerError. The threat model now states the matching scope rule: modifying a mutable object a JAXP method returned or stored (the capability behind the SpotBugs expose-internal-representation patterns) presumes an adversary already running in the process, which the model does not defend against — the isolation here is robustness, not a defended boundary. Assisted-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CLnTBsvmYtxzNTWVGNyz33
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.
The
URIResolverfloor answered every unresolvedxsl:include/xsl:import/document()reference with aDOMSourceover one shared staticDocument. A freshDOMSourcewas created per call, butDOMSource.getNode()hands out the same sharedDocument, which escapes to the consumer; a component mutating a document it received would surface its changes in every later resolution, process-wide.Following the JDK's XSLTC
TransformerImplpattern, the default empty-source supplier now builds a fresh empty document per resolution, throughSecureDocumentBuilderFactory.newNSInstance(boolean)— the same secured, namespace-aware, JDK-pinned-or-overridden factory selection theSourcerewrite uses, an upgrade over the previous rawDocumentBuilderFactory.newInstance()lookup (which also ignoredoverrideDefaultParser). Creation failure now wraps inIllegalStateExceptionper call instead ofExceptionInInitializerErrorat class initialization. The emptyDOMSourcekeeps a null system id, and Saxon'sEmptySource.getInstance()supplier is untouched (a content-less marker with no DOM to mutate).The threat model gains the matching scope rule: exploiting the exposure the SpotBugs expose-internal-representation patterns warn about presumes an adversary already running in the process, a capability the model's adversary does not have — so the per-resolution isolation is robustness, not a defended boundary, and reports premised on mutating a returned object are
OUT-OF-SCOPE: reconfigured.Verified with the full surefire matrix and the GraalVM
-Pnative-xalannative suite (the new default supplier passes inside the native image with no added reflection metadata);ShadingFootprintTestis unchanged, as theSecureDocumentBuilderFactoryclasses were already in both pinned closures.🤖 Generated with Claude Code