Skip to content

Commit 4b940ff

Browse files
Potential fix for code scanning alert no. 5: Resolving XML external entity in user-controlled data
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent c07aa2d commit 4b940ff

File tree

1 file changed

+2
-0
lines changed
  • ganttproject/src/main/java/biz/ganttproject/storage

1 file changed

+2
-0
lines changed

ganttproject/src/main/java/biz/ganttproject/storage/Document.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ private val domParser = DocumentBuilderFactory.newInstance().also {
311311
it.setFeature("http://xml.org/sax/features/external-general-entities", false)
312312
it.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
313313
it.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true)
314+
it.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, "")
315+
it.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, "")
314316
}
315317

316318
@Throws(SAXException::class)

0 commit comments

Comments
 (0)