Skip to content

Commit 43cc752

Browse files
committed
test: reproduce reported security issues for #1061
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 309dd5a commit 43cc752

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.github/workflows/nodejs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ jobs:
119119
- ubuntu-latest
120120
- macos-13 # macos-latest has issues with node14
121121
- windows-latest
122+
includes:
123+
- #
124+
node-version: 20
125+
os: ubuntu-latest
122126
timeout-minutes: 10
123127
steps:
124128
- name: Checkout

tests/integration/Validation.XmlValidator.test.js

+42
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,47 @@ describe('Validation.XmlValidator', () => {
9999
const validationError = await validator.validate(input)
100100
assert.strictEqual(validationError, null)
101101
})
102+
103+
it('is not vulnerable to advisories/GHSA-mjr4-7xg5-pfvh', async () => {
104+
/* report:
105+
see https://github.com/advisories/GHSA-mjr4-7xg5-pfvh
106+
see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1061
107+
*/
108+
const validator = new XmlValidator(version)
109+
/* POC payload:
110+
see https://research.jfrog.com/vulnerabilities/libxmljs2-attrs-type-confusion-rce-jfsa-2024-001034097/#poc
111+
*/
112+
const input = `<?xml version="1.0" encoding="UTF-8"?>
113+
<!DOCTYPE note
114+
[
115+
<!ENTITY writer "` + 'A'.repeat(0x1234) + `">
116+
]>
117+
<from>&writer;</from>
118+
`;
119+
const validationError = await validator.validate(input)
120+
// expected to not crash ...
121+
assert.strictEqual(validationError, null)
122+
})
123+
124+
it('is not vulnerable to advisories/GHSA-78h3-pg4x-j8cv', async () => {
125+
/* report:
126+
see https://github.com/advisories/GHSA-78h3-pg4x-j8cv
127+
see https://github.com/CycloneDX/cyclonedx-javascript-library/issues/1061
128+
*/
129+
const validator = new XmlValidator(version)
130+
/* POC payload:
131+
see https://research.jfrog.com/vulnerabilities/libxmljs2-namespaces-type-confusion-rce-jfsa-2024-001034098/#poc
132+
*/
133+
const input = `<?xml version="1.0" encoding="UTF-8"?>
134+
<!DOCTYPE note
135+
[
136+
<!ENTITY writer PUBLIC "` + "A".repeat(8) + "B".repeat(8) + "C".repeat(8) + "D".repeat(8) + "P".repeat(8) + `" "JFrog Security">
137+
]>
138+
<from>&writer;</from>
139+
`;
140+
const validationError = await validator.validate(input)
141+
// expected to not crash ...
142+
assert.strictEqual(validationError, null)
143+
})
102144
}))
103145
})

0 commit comments

Comments
 (0)