-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CVE-2022-46751 don't parse doctypes and access external entities by d…
…efault
- Loading branch information
Showing
12 changed files
with
605 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
//// | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
|
||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
//// | ||
= Java System Properties Affecting Ivy | ||
== XML Parser Settings | ||
Starting with Ivy 2.5.2 Ivy's XML parser can be controlled via the use | ||
of two newly introduced system properties. | ||
If you want to restore the default behavior of Ivy 2.5.1 and earlier | ||
you need to set `ivy.xml.allow-doctype-processing` to `true` and | ||
`ivy.xml.external-resources` to `ALL`. | ||
=== `ivy.xml.allow-doctype-processing` | ||
This system property accepts `true` or `false` as values. When set to | ||
`false` Ivy will not allow any processing of doctype declarations at | ||
all, while setting it to `true` enables it. | ||
The default is to allow doctype processing if and only if Ivy is | ||
parsing a Maven POM file. | ||
=== `ivy.xml.external-resources` | ||
This system property controls if external resources are read during | ||
doctype processing - and if so, where they can be loadad from. The | ||
value of this system property is only ever used if | ||
`ivy.xml.allow-doctype-processing` is not `false`. | ||
The accepted values are | ||
* `PROHIBIT` makes Ivy fail if any doctype tries to load an external | ||
resource. | ||
* `IGNORE` makes Ivy ignore any external resource that the doctype | ||
declaration wants to load. | ||
* `LOCAL_ONLY` allows external resources to be loaded via `file:` or | ||
`jar:file` URIs only. | ||
* `ALL` allows external resources to be loaded from any URI. | ||
The default behavior is to not allow doctype processing at all, but if | ||
it is enabled the value `PROHIBIT` is assumed unless the property has | ||
been set explicitly. | ||
When reading Maven POMs a specific internal system id is recognized as | ||
resource and will be loaded from a resource shipping with the Ivy | ||
distribution in order to deal with invalid POM files accepted by | ||
Apache Maven - and the default value for this property is | ||
`IGNORE`in that case. See | ||
link:https://issues.apache.org/jira/browse/IVY-921[IVY-921] for | ||
details. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bodewig
Thanks for these fixe
src/java/org/apache/ivy/util/XMLHelper.java l93 :
Unfortunately, this affectation is a problem when XMLreader don't use this property (ex : javax.xml.parsers.SAXParserFactory) : this throws the exception org.xml.sax.SAXNotRecognizedException.
You should write this code like trySetAttribute l402
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @apourche I've created https://issues.apache.org/jira/browse/IVY-1647 for this. I almost missed this comment on a commit, though, so please use the mailing list or open an issue if you find additional problems.
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see 5d69c9a
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2be17bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntelliJ IDEA also will benefit from the release 2.5.3