Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JEP-185 (JAXP-1.5) properties named ACCESS_EXTERNAL_ #51

Open
cowtowncoder opened this issue May 14, 2018 · 4 comments
Open

Comments

@cowtowncoder
Copy link
Member

Apparently there's a JEP to add Yet Another Set of configuration properties (to overlap with existing) ones:

http://openjdk.java.net/jeps/185

and since users will be trying to use them (as per #50) we'll probably need to add support.
(no one from JEP-185 has tried to reach the project prior to this user request)

It is further unfortunate these are added as System properties since that has all the problems of global variables; as well as the question of how these should interact with existing configuration settings.
But it is what it is and this is becoming Oracle's walled garden so. shrug.

@veita
Copy link

veita commented May 14, 2018

The system properties are useful for risk mitigation in legacy applications and third party depencencies where it is often impossible to configure internally used parsers programmatically.

@cowtowncoder
Copy link
Member Author

@veita yes, true enough. Security aspects may be one area where it is one of lesser evils.
I guess the fundamental root cause realistically is that Stax spec did not specify default for "javax.xml.stream.isReplacingEntityReferences" to be false. But that's difficult to rectify at this point.

@cowtowncoder cowtowncoder added the active Issue being actively investigated label Aug 22, 2018
@cowtowncoder
Copy link
Member Author

Note to self: ACCESS_ properties have been added in XMLConstants in Java 7. Given that Woodstox requires only Java 6, this could be problematic if we rely on constants. Except that, I think final static constants may be folded in during compilation... need to verify, but if so, we have to compile on Java 7 (1.7), but Java 6 runtime should still be ok.

@cowtowncoder
Copy link
Member Author

Also: to make sure, JEP part relevant reads:

JAXP 1.5 adds three new API-level properties to limit external connections to specific, named protocols:

javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD: A list of protocols by which external DTDs and external entity references may be accessed.

javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA: A list of protocols via which external schema references, specified by the schemaLocation attribute of import and include elements, may be resolved.

javax.xml.XMLConstants.ACCESS_EXTERNAL_STYLESHEET: A list of protocols via which external references specified in stylesheet constructs such as processing instructions, document() functions, import elements, and include elements may be resolved.

It also adds three corresponding system properties, to provide developers the ability to change the settings without changing code:

javax.xml.accessExternalDTD for ACCESS_EXTERNAL_DTD

javax.xml.accessExternalSchema for ACCESS_EXTERNAL_SCHEMA

javax.xml.accessExternalStylesheet for ACCESS_EXTERNAL_STYLESHEET

Finally, it allows the above properties to be set in the existing configuration file, ${java.home}/lib/jaxp.properties, so as to define the behavior for all invocations of the JDK or JRE. The format of entries in the file is property-name=value, for example:

javax.xml.accessExternalDTD=file,http

and specifically ignores FEATURE_SECURE_PROCESSING, for which I will create separate issue.

@cowtowncoder cowtowncoder changed the title Add support for JEP-185 properties Add support for JEP-185 (JAXP-1.5) properties named ACCESS_EXTERNAL_ Aug 23, 2018
@cowtowncoder cowtowncoder removed the active Issue being actively investigated label Jul 16, 2019
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

No branches or pull requests

2 participants