On Tue, 1 Dec 2026 16:58:35 GMT, Alexey Semenyuk <[email protected]> wrote:
> Configure XML parsers using helpers from the XmlUtils class to disable > pulling in external entities. > > This fixes the main issue and proactively fixes similar issues when external > entities can be pulled in through other xml files (info plist on macOS, xml > source files for MSI packages on Windows). > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java line 156: > 154: > 155: var dbf = XmlUtils.initDocumentBuilderFactory(); > 156: // Disable DOCTYPE element processing. Did you mean `declaration` instead of `element` here and in a sentence below? src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourceConverter.java line 104: > 102: Document inputXmlDom; > 103: try { > 104: var dfb = XmlUtils.initDocumentBuilderFactory(); `dfb` -> `dbf` src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourceConverter.java line 110: > 108: // Malformed XML, don't run converter, save as is. > 109: resource.saveToFile(resourceSaveAsFile); > 110: return Status.SavedAsIsMalfromedXml; Not part of code change, but `SavedAsIsMalfromedXml` -> `SavedAsIsMalformedXml`. src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourceConverter.java line 113: > 111: } catch (ParserConfigurationException ex) { > 112: // Should never happen > 113: throw new RuntimeException(ex); Maybe `throw new IllegalStateException(ex);` to match `initDocumentBuilder`? src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourceConverter.java line 240: > 238: // </WixLocalization> > 239: // > 240: // To workaround default JDK's XSLT processor limitations we do > addition postprocessing of output XML with NamespaceCleaner class. `addition postprocessing` -> `additional postprocessing` test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/XmlUtilsTest.java line 106: > 104: > 105: final var expectedGreeting = switch (xmlSpec) { > 106: case XML_WITH_EMBEDDED_DTD_AND_EXTERNLAL_ENTITY, `EXTERNLAL` -> `EXTERNAL` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763479763 PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763469971 PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763486732 PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763987817 PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763465583 PR Review Comment: https://git.openjdk.org/jdk/pull/34163#discussion_r4763458002
