Skip to content

Commit 0743bd4

Browse files
committedAug 5, 2022
Fixes #387 - Updating DOMPurify detector and test cases
1 parent c3fcdbd commit 0743bd4

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed
 

‎repository/jsrepository.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,14 @@
11471147
"summary": "XSS in $sanitize in Safari/Firefox"
11481148
},
11491149
"info" : [ "https://github.com/angular/angular.js/commit/8f31f1ff43b673a24f84422d5c13d6312b2c4d94" ]
1150+
},
1151+
{
1152+
"below" : "1.999",
1153+
"severity": "low",
1154+
"identifiers": {
1155+
"summary": "End-of-Life: Long term support for AngularJS has been discontinued"
1156+
},
1157+
"info" : [ "https://blog.angular.io/discontinued-long-term-support-for-angularjs-cc066b82e65a?gi=9d3103b5445c" ]
11501158
}
11511159
],
11521160
"extractors" : {
@@ -1495,7 +1503,9 @@
14951503
"filecontent" : [
14961504
"DOMPurify.version = '(§§version§§)';",
14971505
"DOMPurify.version=\"(§§version§§)\"",
1498-
"DOMPurify=.[^\\r\\n]{10,500}\\.version=\"(§§version§§)\""
1506+
"DOMPurify=.[^\\r\\n]{10,850}?\\.version=\"(§§version§§)\"",
1507+
"/\\*! @license DOMPurify (§§version§§)",
1508+
"var .=\"dompurify\"+.{10,550}?\\.version=\"(§§version§§)\""
14991509
],
15001510
"hashes" : {}
15011511
}

‎repository/test-detection.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
23
const crypto = require("crypto");
34
const testCases = require("./testcases.json");
45

@@ -53,7 +54,10 @@ async function runTests(jsRepo) {
5354
if (limit && limit != name) continue;
5455
console.log(`Testing ${name}`)
5556
for (let [template, tcontent] of Object.entries(content)) {
56-
let { versions, subversions, contentOnly } = tcontent;
57+
let { versions, subversions, contentOnly, additionalVersions } = tcontent;
58+
if (limit) {
59+
versions = Array.from(new Set(versions.concat(additionalVersions)))
60+
}
5761
subversions = subversions || [ "" ];
5862
for (let version of versions) {
5963
for (let sub of subversions) {
@@ -103,4 +107,4 @@ repo.loadrepositoryFromFile("./jsrepository.json", options).on('done', (jsRepo)
103107
runTests(jsRepo)
104108
.then(() => console.log("Done!"))
105109
.catch(err => console.warn("Failed!", err));
106-
})
110+
}).on('error', err => console.warn("Failed!", err));

‎repository/testcases.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@
9191
"versions" : [ "12.1.6" ],
9292
"contentOnly" : true
9393
},
94-
"https://nextjs.org/_next/static/chunks/main-c4649a899de7396f.js" : {
95-
"versions" : [ "12.2.4-canary.0" ],
96-
"contentOnly" : true
97-
},
9894
"https://demo.vercel.store/_next/static/chunks/main-42cf2f391f50f1e7.js" : {
9995
"versions" : [ "12.1.6" ],
10096
"contentOnly" : true
@@ -110,5 +106,13 @@
110106
"https://cdnjs.cloudflare.com/ajax/libs/vue/§§version§§/vue.min.js" : {
111107
"versions" : [ "2.7.6", "1.0.28" ]
112108
}
109+
},
110+
111+
"DOMPurify" : {
112+
"https://raw.githubusercontent.com/cure53/DOMPurify/§§version§§/dist/purify.min.js" : {
113+
"versions" : [ "1.0.1", "1.0.11", "2.3.10", "2.0.12" ],
114+
"contentOnly" : true,
115+
"additionalVersions" : [ "1.0.0", "1.0.1", "1.0.10", "1.0.11", "1.0.2", "1.0.4", "1.0.5", "1.0.6", "1.0.7", "1.0.8", "1.0.9", "2.0.0", "2.0.1", "2.0.10", "2.0.11", "2.0.12", "2.0.13", "2.0.14", "2.0.15", "2.0.16", "2.0.17", "2.0.2", "2.0.3", "2.0.4", "2.0.5", "2.0.6", "2.0.7", "2.0.8", "2.0.9", "2.1.0", "2.2.0", "2.2.2", "2.2.3", "2.2.4", "2.2.6", "2.2.7", "2.2.8", "2.2.9", "2.3.0", "2.3.1", "2.3.10", "2.3.2", "2.3.3", "2.3.4", "2.3.5", "2.3.6", "2.3.8", "2.3.9" ]
116+
}
113117
}
114118
}

0 commit comments

Comments
 (0)
Failed to load comments.