Skip to content

Commit

Permalink
Merge pull request #2387 from cisagov/dependabot/npm_and_yarn/backend…
Browse files Browse the repository at this point in the history
…/axios-1.6.2

Bump axios from 0.27.2 to 1.6.2 in /backend
  • Loading branch information
Matthew-Grayson authored Jan 2, 2024
2 parents a32ee59 + a8f090c commit 7029749
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 48 deletions.
3 changes: 3 additions & 0 deletions backend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = {
'/node_modules/',
'.*report.*' // Remove this when we enable report / vulnerability functionality
],
moduleNameMapper: {
'^axios$': require.resolve('axios')
},
coverageThreshold: {
global: {
branches: 50
Expand Down
13 changes: 7 additions & 6 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@elastic/elasticsearch": "~7.10.0",
"@thefaultvault/tfv-cpe-parser": "^1.3.0",
"aws-sdk": "^2.1352.0",
"axios": "^0.27",
"axios": "^1.6",
"body-parser": "^1.19.0",
"bufferutil": "^4.0.7",
"class-transformer": "^0.3.1",
Expand Down
9 changes: 1 addition & 8 deletions backend/src/tasks/cve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import { plainToClass } from 'class-transformer';
import { CommandOptions } from './ecs-client';
import * as buffer from 'buffer';
import saveVulnerabilitiesToDb from './helpers/saveVulnerabilitiesToDb';
import {
LessThan,
MoreThan,
FindOperator,
In,
MoreThanOrEqual,
Not
} from 'typeorm';
import { LessThan, MoreThan, In, MoreThanOrEqual, Not } from 'typeorm';
import * as fs from 'fs';
import * as zlib from 'zlib';
import axios, { AxiosResponse } from 'axios';
Expand Down
68 changes: 35 additions & 33 deletions backend/src/tasks/test/cve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
Vulnerability
} from '../../models';
import * as nock from 'nock';
import * as zlib from 'zlib';

const unzipSyncSpy = jest.spyOn(zlib, 'unzipSync');

jest.mock('child_process', () => ({
spawnSync: () => null,
Expand All @@ -26,39 +29,6 @@ jest.mock('fs', () => ({
}
}));

jest.mock('zlib', () => ({
unzipSync: (contents) =>
Buffer.from(
JSON.stringify({
CVE_Items: [
{
cve: {
CVE_data_meta: { ID: 'CVE-2019-10866' },
description: {
description_data: [
{
lang: 'en',
value: 'Test description'
}
]
},
references: {
reference_data: [
{
url: 'https://example.com',
name: 'https://example.com',
refsource: 'CONFIRM',
tags: ['Patch', 'Vendor Advisory']
}
]
}
}
}
]
})
)
}));

jest.setTimeout(30000);

const RealDate = Date;
Expand All @@ -67,6 +37,37 @@ describe('cve', () => {
let connection;
beforeAll(async () => {
connection = await connectToDatabase();
unzipSyncSpy.mockImplementation((contents) =>
Buffer.from(
JSON.stringify({
CVE_Items: [
{
cve: {
CVE_data_meta: { ID: 'CVE-2019-10866' },
description: {
description_data: [
{
lang: 'en',
value: 'Test description'
}
]
},
references: {
reference_data: [
{
url: 'https://example.com',
name: 'https://example.com',
refsource: 'CONFIRM',
tags: ['Patch', 'Vendor Advisory']
}
]
}
}
}
]
})
)
);
});
beforeEach(() => {
global.Date.now = jest.fn(() => new Date('2019-04-22T10:20:30Z').getTime());
Expand All @@ -76,6 +77,7 @@ describe('cve', () => {
global.Date = RealDate;
});
afterAll(async () => {
unzipSyncSpy.mockRestore();
await connection.close();
nock.cleanAll();
});
Expand Down

0 comments on commit 7029749

Please sign in to comment.