Skip to content

Commit 3322cb3

Browse files
fix: update jsondiffpatch and axios to address CVEs (#1494)
* fix: update jsondiffpatch and axios to address CVEs * update nightwatch options to disable alerts from Chrome's password manager
1 parent 263e299 commit 3322cb3

File tree

7 files changed

+262
-337
lines changed

7 files changed

+262
-337
lines changed

__mocks__/jsondiffpatchMock.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// mock calls to diff() from jsondiffpatch
2+
module.exports = {
3+
diff: function() {
4+
return {
5+
"mock": "a mock object"
6+
};
7+
},
8+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// mock calls to format() from jsondiffpatch/formatters/html
2+
module.exports = {
3+
format: function() {
4+
return "<div>mock json diff</div>";
5+
},
6+
};

app/addons/documents/rev-browser/components/revisiondiffarea.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
import React from 'react';
1414
import PropTypes from 'prop-types';
1515
import * as jdp from "jsondiffpatch";
16-
import "jsondiffpatch/dist/formatters-styles/html.css";
16+
import * as jdpHtmlFormatter from 'jsondiffpatch/formatters/html';
17+
import "jsondiffpatch/formatters/styles/html.css";
1718

1819
const RevisionDiffArea = ({ours, theirs}) => {
1920
if (!ours || !theirs) {
2021
return <div></div>;
2122
}
2223

2324
const delta = jdp.diff(ours, theirs);
24-
const html = jdp.formatters.html.format(delta, ours);
25+
const html = jdpHtmlFormatter.format(delta, ours);
2526

2627
return (
2728
<div className="revision-diff-area">

jest-config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"./ace-worker-mango.js": "<rootDir>/app/addons/components/components/ace-worker-mango.js",
1414

1515
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|swf|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
16-
"\\.(css|less|scss)$": "<rootDir>/__mocks__/styleMock.js"
16+
"\\.(css|less|scss)$": "<rootDir>/__mocks__/styleMock.js",
17+
18+
"jsondiffpatch": "<rootDir>/__mocks__/jsondiffpatchMock.js",
19+
"jsondiffpatch/formatters/html": "<rootDir>/__mocks__/jsondiffpatch_HtmlFormatterMock.js"
1720
},
1821

1922
"testEnvironmentOptions": {

0 commit comments

Comments
 (0)