Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions node/lib/retire.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ function check(results, repo) {
if (isDefined(vulns[i].atOrAbove) && !isAtOrAbove(result.version, vulns[i].atOrAbove)) {
continue;
}
if (isDefined(vulns[i].excludes) && vulns[i].excludes.indexOf(result.version) !== -1) {
continue;
}
var vulnerability = { info: vulns[i].info, below: vulns[i].below, atOrAbove: vulns[i].atOrAbove };
if (vulns[i].severity) {
vulnerability.severity = vulns[i].severity;
Expand Down
12 changes: 12 additions & 0 deletions node/spec/tests/versions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,16 @@ describe('versions', function () {
assert.isNotVulnerable(result);
done();
});
it('should_not_be_vulnerable_when_version_in_excludes_list', function (done) {
repo.jquery.vulnerabilities = [{ atOrAbove: '1.0.0', below: '3.0.0', excludes: ['1.12.4-aem'] }];
const result = retire.scanUri('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4-aem/jquery.min.js', repo);
assert.isNotVulnerable(result);
done();
});
it('should_be_vulnerable_when_similar_version_not_in_excludes_list', function (done) {
repo.jquery.vulnerabilities = [{ atOrAbove: '1.0.0', below: '3.0.0', excludes: ['1.12.4-aem'] }];
const result = retire.scanUri('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', repo);
assert.isVulnerable(result);
done();
});
});
1 change: 1 addition & 0 deletions node/src/repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function validateRepository(
.object({
below: versionValidator,
atOrAbove: versionValidator.optional(),
excludes: z.array(versionValidator).optional(),
severity: z.enum(keys),
cwe: z.array(z.string().regex(/^CWE-[0-9]+$/)).min(1),
identifiers: z
Expand Down
1 change: 1 addition & 0 deletions node/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type Repository = Record<
export type Vulnerability = {
below: string;
atOrAbove?: string;
excludes?: string[];
severity: SeverityLevel;
cwe: string[];
identifiers: {
Expand Down
8 changes: 6 additions & 2 deletions repository/convertFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ function convertToOldFormat(
const { ranges, summary, identifiers, info, ...rest } = v;

ranges.forEach((r) => {
vulns.push({
const vuln = {
...r,
...rest,
identifiers: { summary, ...identifiers },
info,
});
};
if (r.excludes) {
vuln.excludes = r.excludes;
}
vulns.push(vuln);
});
});
vulns.sort((a, b) => {
Expand Down
15 changes: 10 additions & 5 deletions repository/jsrepository-master.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
},
{
"atOrAbove": "1.12.3",
"below": "3.0.0-beta1"
"below": "3.0.0-beta1",
"excludes": ["1.12.4-aem"]
}
],
"summary": "3rd party CORS request may execute",
Expand Down Expand Up @@ -138,7 +139,8 @@
"ranges": [
{
"atOrAbove": "1.1.4",
"below": "3.4.0"
"below": "3.4.0",
"excludes": ["1.12.4-aem"]
}
],
"summary": "jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution",
Expand All @@ -159,7 +161,8 @@
"ranges": [
{
"atOrAbove": "1.2.0",
"below": "3.5.0"
"below": "3.5.0",
"excludes": ["1.12.4-aem"]
}
],
"summary": "Regex in its jQuery.htmlPrefilter sometimes may introduce XSS",
Expand All @@ -176,7 +179,8 @@
"ranges": [
{
"atOrAbove": "1.0.3",
"below": "3.5.0"
"below": "3.5.0",
"excludes": ["1.12.4-aem"]
}
],
"summary": "passing HTML containing <option> elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code.",
Expand All @@ -192,7 +196,8 @@
{
"ranges": [
{
"below": "2.999.999"
"below": "2.999.999",
"excludes": ["1.12.4-aem"]
}
],
"summary": "jQuery 1.x and 2.x are End-of-Life and no longer receiving security updates",
Expand Down
15 changes: 15 additions & 0 deletions repository/jsrepository-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
},
{
"below": "2.999.999",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1104"
],
Expand All @@ -142,6 +145,9 @@
{
"atOrAbove": "1.12.3",
"below": "3.0.0-beta1",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down Expand Up @@ -185,6 +191,9 @@
{
"atOrAbove": "1.1.4",
"below": "3.4.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1321",
"CWE-79"
Expand All @@ -207,6 +216,9 @@
{
"atOrAbove": "1.0.3",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand All @@ -226,6 +238,9 @@
{
"atOrAbove": "1.2.0",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down
15 changes: 15 additions & 0 deletions repository/jsrepository-v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
},
{
"below": "2.999.999",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1104"
],
Expand All @@ -149,6 +152,9 @@
{
"atOrAbove": "1.12.3",
"below": "3.0.0-beta1",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down Expand Up @@ -192,6 +198,9 @@
{
"atOrAbove": "1.1.4",
"below": "3.4.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1321",
"CWE-79"
Expand All @@ -214,6 +223,9 @@
{
"atOrAbove": "1.0.3",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand All @@ -233,6 +245,9 @@
{
"atOrAbove": "1.2.0",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down
15 changes: 15 additions & 0 deletions repository/jsrepository-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
},
{
"below": "2.999.999",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1104"
],
Expand All @@ -148,6 +151,9 @@
{
"atOrAbove": "1.12.3",
"below": "3.0.0-beta1",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down Expand Up @@ -191,6 +197,9 @@
{
"atOrAbove": "1.1.4",
"below": "3.4.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1321",
"CWE-79"
Expand All @@ -213,6 +222,9 @@
{
"atOrAbove": "1.0.3",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand All @@ -232,6 +244,9 @@
{
"atOrAbove": "1.2.0",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down
15 changes: 15 additions & 0 deletions repository/jsrepository.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
},
{
"below": "2.999.999",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1104"
],
Expand All @@ -142,6 +145,9 @@
{
"atOrAbove": "1.12.3",
"below": "3.0.0-beta1",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down Expand Up @@ -185,6 +191,9 @@
{
"atOrAbove": "1.1.4",
"below": "3.4.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-1321",
"CWE-79"
Expand All @@ -207,6 +216,9 @@
{
"atOrAbove": "1.0.3",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand All @@ -226,6 +238,9 @@
{
"atOrAbove": "1.2.0",
"below": "3.5.0",
"excludes": [
"1.12.4-aem"
],
"cwe": [
"CWE-79"
],
Expand Down