Skip to content

Disallow DOCTYPE in TestReader XML parser - #1252

Open
Keerthana-64 wants to merge 1 commit into
locationtech:masterfrom
Keerthana-64:testreader-disallow-doctype
Open

Keerthana-64 wants to merge 1 commit into
locationtech:masterfrom
Keerthana-64:testreader-disallow-doctype

Conversation

@Keerthana-64

Copy link
Copy Markdown

TestReader.createTestRun on master, for a test file that declares an external entity:

<!DOCTYPE run [ <!ENTITY ext SYSTEM "file:///.../secret.txt"> ]>
<run><case><a>&ext;</a> ... </case></run>

parsing problems: []
geometry A = POINT (5 10)        <- contents of secret.txt

Follow up to #1244. TestReader is the remaining XML parser in the repo without that configuration, and it is what JTSTestRunner and the TestBuilder use to open XML test files, which are regularly posted in issues here. A <!DOCTYPE run SYSTEM "http://..."> is also fetched on master (checked against a local HTTP server: 1 request before, 0 after).

Test files do not need a DOCTYPE (none of the XML test files in the repo have one, and XMLTestWriter does not write one), so the SAXBuilder now sets disallow-doctype-decl. If a SAX driver does not recognize the feature, JDOM rejects the file instead of parsing it without the setting.

testExternalGeometryNotIncluded in TestReaderTest fails on master and passes with the change, and mvn clean install passes. KMLReaderExample also uses a default XMLReader, but it only reads a hard-coded local path, so I left it as is.

Test files do not require DOCTYPE. Configure the TestReader SAXBuilder
to reject it, as GMLReader and KMLReader now do.

Signed-off-by: Keerthana KT <keerthana@labs.digiscrypt.com>

This branch has not been deployed

No deployments
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.

1 participant