dsmiley commented on code in PR #962:
URL: https://github.com/apache/solr/pull/962#discussion_r939393817
##########
solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java:
##########
@@ -376,10 +377,12 @@ protected long getConfigVersion(SolrCore core) {
*
* @return The loaded {@link ElevationProvider}; not null.
*/
- private ElevationProvider loadElevationProvider(SolrCore core) throws
Exception {
- XmlConfigFile cfg;
+ private ElevationProvider loadElevationProvider(SolrCore core) throws
IOException, SAXException {
+ InputStream inputStream = null;
+ Document xmlDocument;
try {
- cfg = new XmlConfigFile(core.getResourceLoader(), configFileName);
+ inputStream = core.getResourceLoader().openResource(configFileName);
+ xmlDocument = SafeXMLParsing.parseUntrustedXML(log, inputStream);
Review Comment:
I think I completely overlooked something (my bad). I was initially
concerned about using XmlConfigFile because it did not use Solr's
SafeXMLParsing utility, and I could also see it enabling some XInclude & entity
resolver stuff, which concerned me in its use for elevate.xml. But this
doesn't mean it's not "safe". Upon further inspection, it appears to be doing
some of the same stuff that SafeXMLParsing does in the `parseConfigXML` method,
which is relatively safe as it doesn't escape the resource loader. Do you see
@haythemkh ? If you agree, do you think XmlConfigFile could be modified to
call `SafeXMLParsing.parseConfigXml` so that the safe-ness is clear? If not,
we could at least leave a comment there.
At this place in QEC, we could replace these two lines with
`SafeXMLParsing.parseConfigXml` and we would in fact continue to support these
somewhat exotic XML features in a "safe" way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]