Skip to content

Commit f22f843

Browse files
committed
handle new cases
1 parent 53491e7 commit f22f843

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/main/java/eu/righettod/SecurityUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ public static UUID computeUUIDv7() {
13831383
}
13841384

13851385
/**
1386-
* Ensure that an XSD file does not contain any include/import instruction (prevent exposure to SSRF).
1386+
* Ensure that an XSD file does not contain any include/import/redefine instruction (prevent exposure to SSRF).
13871387
*
13881388
* @param xsdFilePath Filename of the XSD file to check.
13891389
* @return True only if the file pass all validations.

src/test/java/eu/righettod/TestSecurityUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ public void computeUUIDv7() {
658658

659659
@Test
660660
public void isXSDSafe() {
661-
List<String> unsafeFileList = Arrays.asList("test-xsd-with-external-schema-via-import.xsd", "test-xsd-with-external-schema-via-include.xsd");
661+
List<String> unsafeFileList = Arrays.asList("test-xsd-with-external-schema-via-import.xsd", "test-xsd-with-external-schema-via-include.xsd", "test-xsd-with-external-schema-via-redefine.xsd");
662662
unsafeFileList.forEach(f -> {
663663
String testFile = getTestFilePath(f);
664664
assertFalse(SecurityUtils.isXSDSafe(testFile), String.format(TEMPLATE_MESSAGE_FALSE_NEGATIVE_FOR_FILE, testFile));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/purchaseorder" elementFormDefault="qualified">
3+
<xs:redefine schemaLocation="https://righettod.eu/test.xsd"/>
4+
<xs:element name="orderId" type="xs:string"/>
5+
</xs:schema>

0 commit comments

Comments
 (0)