Skip to content

Commit 4af81f2

Browse files
przemyslaw-wlodekmchappelltomislavhoracek
authored
[DDW-821] Update packages with vulnerabilities (#2769)
* [DDW-821] Upgrade packages with vulnerabilities * [DDW-821] Update node headers SHA checksum * [DDW-821] Update CHANGELOG.md * [DDW-821] Upgrade packages with vulnerabilities * [DDW-821] Update node headers SHA checksum * [DDW-821] Update CHANGELOG.md * [DDW-821] Downgrade electron-rebuild * Revert "[DDW-821] Downgrade electron-rebuild" This reverts commit ce4eabb. * Run lockfile:fix * Revert "Revert "[DDW-821] Downgrade electron-rebuild"" This reverts commit debe1c3. * [DDW-821] upgrate low severity vulnerabilities * [DDW-821] align babel config for private methods, class properties and object properties * [DDW-821] Remove explicit resolve-url installation * [DDW-821] Replace deprecated babel-eslint with @babel/eslint-parser * [DDW-821] Fix eslint error by wrapping util script in IIFE * [DDW-821] Fix yarn.lock Co-authored-by: Michael Chappell <michael.chappell@iohk.io> Co-authored-by: Tomislav Horaček <tomislav@tt-media.hr>
1 parent 9d76870 commit 4af81f2

File tree

8 files changed

+1064
-490
lines changed

8 files changed

+1064
-490
lines changed

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"plugins": [
88
["@babel/plugin-proposal-decorators", { "legacy": true }],
99
["@babel/plugin-proposal-class-properties", { "loose": true }],
10+
["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
1011
[
1112
"@babel/plugin-proposal-private-methods",
1213
{

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@babel/eslint-parser",
33
"parserOptions": {
44
"ecmaFeatures": {
55
"legacyDecorators": true

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## vNext
4+
5+
### Chores
6+
7+
- Updated vulnerable dependencies ([PR 2769](https://github.com/input-output-hk/daedalus/pull/2769))
8+
39
## 4.6.0
410

511
### Features

installers/nix/electron.nix

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
libxkbcommon }:
33

44
let
5-
version = "13.1.1";
5+
version = "13.6.3";
66
name = "electron-${version}";
77

88
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
@@ -21,19 +21,19 @@ let
2121
src = {
2222
i686-linux = fetchurl {
2323
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-ia32.zip";
24-
sha256 = "fed00edaaba0c4a615fe835baf7d0d0ff893dff902800006bf63cc994c24d3dd";
24+
sha256 = "db9261c05ed57af2fcd4a84b89d299c76948b9d57ce0dba38e3240eb43935257";
2525
};
2626
x86_64-linux = fetchurl {
2727
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-x64.zip";
28-
sha256 = "eb6ae81d71a4d390ec5140d907b191a84c37621176eec9369bb6fc3bf8570e3b";
28+
sha256 = "7607422a4ba80cda4bd7fefb2fbe2f4e0b9a73db92e1e82dc01012a85b5d0d2b";
2929
};
3030
armv7l-linux = fetchurl {
3131
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-armv7l.zip";
32-
sha256 = "7e745a38c6761fa9826b3b9b8d0bd060126a3949da6f3f09f11b842e5e22cee4";
32+
sha256 = "a293a9684e16a427a9f68d101814575a4b1dd232dc3fca47552f906019a6cadc";
3333
};
3434
aarch64-linux = fetchurl {
3535
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-linux-arm64.zip";
36-
sha256 = "445c88e9c9b33abbdb263103736fb5203938b0643bc5377fbdf12b444d26f211";
36+
sha256 = "1599d259832c806b98751a68fb93112711963d259024f0e36f12f064995b3251";
3737
};
3838
}.${stdenv.hostPlatform.system} or throwSystem;
3939

@@ -59,11 +59,11 @@ let
5959
src = {
6060
x86_64-darwin = fetchurl {
6161
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-darwin-x64.zip";
62-
sha256 = "1594ba9aa2e2aa059a03e6b70e16b8116de1998b38f8360801e113fa8d72938c";
62+
sha256 = "6bf09794d6f020bbaaf806a7758da125137b3c96646f4503eb81b9541e50e02f";
6363
};
6464
aarch64-darwin = fetchurl {
6565
url = "https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-darwin-arm64.zip";
66-
sha256 = "7045538917c36214127b7f11a3223396c7199ac19e989e5648a0963773962e6c";
66+
sha256 = "374ddf0581794b31eee900828172f9218193c032c0e46bffcfac6aec95c22f1a";
6767
};
6868
}.${stdenv.hostPlatform.system} or throwSystem;
6969

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,17 @@
6868
"electron": "./node_modules/.bin/electron"
6969
},
7070
"devDependencies": {
71-
"@babel/cli": "7.2.0",
72-
"@babel/core": "7.4.5",
73-
"@babel/helper-create-regexp-features-plugin": "7.7.0",
71+
"@babel/cli": "7.16.0",
72+
"@babel/core": "7.16.0",
73+
"@babel/eslint-parser": "7.16.3",
74+
"@babel/helper-create-regexp-features-plugin": "7.16.0",
7475
"@babel/plugin-proposal-class-properties": "7.2.1",
75-
"@babel/plugin-proposal-decorators": "7.2.0",
76+
"@babel/plugin-proposal-decorators": "7.16.4",
7677
"@babel/plugin-proposal-object-rest-spread": "7.2.0",
7778
"@babel/plugin-transform-runtime": "7.2.0",
7879
"@babel/polyfill": "7.0.0",
79-
"@babel/preset-env": "7.2.0",
80-
"@babel/preset-flow": "7.8.3",
80+
"@babel/preset-env": "7.16.4",
81+
"@babel/preset-flow": "7.16.0",
8182
"@babel/preset-react": "7.0.0",
8283
"@babel/register": "7.0.0",
8384
"@dump247/storybook-state": "1.6.1",
@@ -91,25 +92,24 @@
9192
"@testing-library/react": "12.1.2",
9293
"asar": "2.1.0",
9394
"autodll-webpack-plugin": "0.4.2",
94-
"axios": "0.21.1",
95-
"babel-eslint": "10.1.0",
95+
"axios": "0.24.0",
9696
"babel-loader": "8.0.4",
9797
"babel-plugin-react-intl": "3.0.1",
9898
"bufferutil": "4.0.1",
9999
"cache-loader": "4.1.0",
100-
"chai": "4.2.0",
100+
"chai": "4.3.4",
101101
"chalk": "4.1.0",
102102
"concurrently": "5.3.0",
103103
"cross-env": "7.0.2",
104104
"css-loader": "2.0.1",
105105
"cucumber": "6.0.5",
106106
"cucumber-pretty": "6.0.0",
107107
"del": "6.0.0",
108-
"electron-chromedriver": "13.0.0",
108+
"electron-chromedriver": "16.0.0",
109109
"electron-connect": "0.6.3",
110110
"electron-devtools-installer": "3.2.0",
111-
"electron-packager": "15.2.0",
112-
"electron-rebuild": "1.11.0",
111+
"electron-packager": "15.4.0",
112+
"electron-rebuild": "2.0.1",
113113
"eslint": "7.10.0",
114114
"eslint-config-airbnb": "18.2.0",
115115
"eslint-config-prettier": "6.12.0",
@@ -138,15 +138,15 @@
138138
"jest-environment-jsdom": "26.6.2",
139139
"jest-svg-transformer": "^1.0.0",
140140
"markdown-loader": "5.1.0",
141-
"mini-css-extract-plugin": "0.9.0",
141+
"mini-css-extract-plugin": "0.12.0",
142142
"minimist": "1.2.5",
143143
"mobx-react-devtools": "6.1.1",
144144
"node-forge": "0.10.0",
145145
"node-libs-browser": "2.2.1",
146146
"node-sass": "4.14.1",
147147
"nodemon": "2.0.4",
148148
"npmlog": "4.1.2",
149-
"postcss": "7.0.27",
149+
"postcss": "7.0.39",
150150
"postcss-modules": "1.5.0",
151151
"prettier": "2.1.2",
152152
"pretty-quick": "3.0.2",
@@ -155,7 +155,6 @@
155155
"react-intl-translations-manager": "5.0.3",
156156
"react-syntax-highlighter": "13.5.3",
157157
"regenerator-runtime": "0.13.7",
158-
"resolve-url": "0.2.1",
159158
"sass-loader": "7.1.0",
160159
"sinon": "9.2.2",
161160
"spawn-sync": "2.0.0",
@@ -196,11 +195,11 @@
196195
"classnames": "2.2.6",
197196
"csv-stringify": "5.5.1",
198197
"cucumber-html-reporter": "5.2.0",
199-
"electron": "13.1.1",
198+
"electron": "13.6.3",
200199
"electron-log-daedalus": "2.2.21",
201-
"electron-store": "8.0.0",
200+
"electron-store": "8.0.1",
202201
"es6-error": "4.1.1",
203-
"find-process": "1.4.4",
202+
"find-process": "1.4.7",
204203
"fireworks-js": "1.0.4",
205204
"form-data": "3.0.0",
206205
"fs-extra": "9.0.1",
@@ -214,7 +213,7 @@
214213
"lodash": "4.17.21",
215214
"lodash-es": "4.17.15",
216215
"mime-types": "2.1.27",
217-
"mkdirp": "0.5.1",
216+
"mkdirp": "0.5.5",
218217
"mobx": "5.15.7",
219218
"mobx-react": "6.3.0",
220219
"mobx-react-form": "2.0.8",
@@ -256,7 +255,7 @@
256255
"tcp-port-used": "1.0.1",
257256
"trezor-connect": "8.2.0-extended",
258257
"unorm": "1.6.0",
259-
"validator": "13.1.17"
258+
"validator": "13.7.0"
260259
},
261260
"devEngines": {
262261
"node": ">=14.17.0",

utils/create-news-verification-hashes/index.js

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -23,70 +23,71 @@ const readModuleFile = (path, callback) => {
2323
}
2424
}
2525

26-
// Start script
27-
console.log('\n\x1b[36m%s\x1b[0m', 'Creating news verification hashes...\n');
26+
(() => {
27+
// Start script
28+
console.log('\n\x1b[36m%s\x1b[0m', 'Creating news verification hashes...\n');
2829

29-
const newsEnvironment = process.env.NEWS_ENV;
30-
const allowedFiles = [
31-
{ name: 'newsfeed_development.json', env: 'development' },
32-
{ name: 'newsfeed_mainnet.json', env: 'mainnet' },
33-
{ name: 'newsfeed_staging.json', env: 'staging' },
34-
{ name: 'newsfeed_testnet.json', env: 'testnet' },
35-
{ name: 'news.dummy.json', env: 'dummy_development' }, // Faked test file for development purposes
36-
];
30+
const newsEnvironment = process.env.NEWS_ENV;
31+
const allowedFiles = [
32+
{ name: 'newsfeed_development.json', env: 'development' },
33+
{ name: 'newsfeed_mainnet.json', env: 'mainnet' },
34+
{ name: 'newsfeed_staging.json', env: 'staging' },
35+
{ name: 'newsfeed_testnet.json', env: 'testnet' },
36+
{ name: 'news.dummy.json', env: 'dummy_development' }, // Faked test file for development purposes
37+
];
3738

38-
let filesToHash = [];
39-
if (newsEnvironment) {
40-
const fileName = `newsfeed_${newsEnvironment.toLowerCase()}.json`;
41-
const fileAllowed = lodash.find(allowedFiles, (allowedFile => allowedFile.name === fileName));
42-
if (fileAllowed) {
43-
filesToHash.push(fileAllowed);
39+
let filesToHash = [];
40+
if (newsEnvironment) {
41+
const fileName = `newsfeed_${newsEnvironment.toLowerCase()}.json`;
42+
const fileAllowed = lodash.find(allowedFiles, (allowedFile => allowedFile.name === fileName));
43+
if (fileAllowed) {
44+
filesToHash.push(fileAllowed);
45+
} else {
46+
console.log(`FILE: \x1b[31m ${fileName} not allowed. Use one of available environments \x1b[0m development | staging | testnet | mainnet \n`, '\x1b[0m');
47+
return;
48+
}
49+
}
50+
51+
if (filesToHash.length === 0) {
52+
filesToHash = allowedFiles;
53+
console.log(`\x1b[36m I am hashing ALL available files: [ \x1b[32m ${lodash.map(filesToHash, file => file.name)} \x1b[36m ]`, '\x1b[0m')
4454
} else {
45-
console.log(`FILE: \x1b[31m ${fileName} not allowed. Use one of available environments \x1b[0m development | staging | testnet | mainnet \n`, '\x1b[0m');
46-
return;
55+
console.log(`\x1b[36m I am hashing files: [ \x1b[32m ${lodash.map(filesToHash, file => file.name)} \x1b[36m ]`, '\x1b[0m')
4756
}
48-
}
4957

50-
if (filesToHash.length === 0) {
51-
filesToHash = allowedFiles;
52-
console.log(`\x1b[36m I am hashing ALL available files: [ \x1b[32m ${lodash.map(filesToHash, file => file.name)} \x1b[36m ]`, '\x1b[0m')
53-
} else {
54-
console.log(`\x1b[36m I am hashing files: [ \x1b[32m ${lodash.map(filesToHash, file => file.name)} \x1b[36m ]`, '\x1b[0m')
55-
}
58+
console.log('\n \x1b[33m', 'NOTE: create file with NAME and put HASH as content! \n', '\x1b[0m');
59+
lodash.map(filesToHash, file => {
60+
readModuleFile(`../../source/renderer/app/config/newsfeed-files/${file.name}`, function (error, fileContent) {
61+
// Log Environment
62+
console.log('\n \x1b[32m', `${lodash.capitalize(file.env)}`, '\x1b[0m');
63+
if (error) { // e.g.File not found
64+
console.log('\x1b[31m', error.message, '\x1b[36m');
65+
} else {
66+
// Check if file is valid JSON file
67+
let parsedFile;
68+
try {
69+
parsedFile = JSON.parse(fileContent);
70+
} catch (err) {
71+
console.log(`\x1b[31m File: ${file.name} is not VALID json file. Please check file and try again!`, '\x1b[0m')
72+
return;
73+
}
5674

57-
console.log('\n \x1b[33m', 'NOTE: create file with NAME and put HASH as content! \n', '\x1b[0m');
58-
lodash.map(filesToHash, file => {
59-
readModuleFile(`../../source/renderer/app/config/newsfeed-files/${file.name}`, function (error, fileContent) {
60-
// Log Environment
61-
console.log('\n \x1b[32m', `${lodash.capitalize(file.env)}`, '\x1b[0m');
62-
if (error) { // e.g.File not found
63-
console.log('\x1b[31m', error.message, '\x1b[36m');
64-
} else {
65-
// Check if file is valid JSON file
66-
let parsedFile;
67-
try {
68-
parsedFile = JSON.parse(fileContent);
69-
} catch (err) {
70-
console.log(`\x1b[31m File: ${file.name} is not VALID json file. Please check file and try again!`, '\x1b[0m')
71-
return;
72-
}
73-
74-
// Check all timestamps in file and throw error if there are duplicates
75-
const timestamps = lodash.map(parsedFile.items, (item => (item.date)))
76-
const hasDuplicatedTimestamps = lodash.uniq(timestamps).length !== timestamps.length;
77-
if (hasDuplicatedTimestamps) {
78-
console.log(`\x1b[31m File: ${file.name} has duplicated TIMESTAMPS. Please check file and try again!`, '\x1b[0m');
79-
return;
80-
}
75+
// Check all timestamps in file and throw error if there are duplicates
76+
const timestamps = lodash.map(parsedFile.items, (item => (item.date)))
77+
const hasDuplicatedTimestamps = lodash.uniq(timestamps).length !== timestamps.length;
78+
if (hasDuplicatedTimestamps) {
79+
console.log(`\x1b[31m File: ${file.name} has duplicated TIMESTAMPS. Please check file and try again!`, '\x1b[0m');
80+
return;
81+
}
8182

82-
// Create verification hash
83-
const hash = crypto.createHash('sha256');
84-
const hashBuffer = hash.digest(hash.update(fileContent, 'utf8'));
85-
const hashArray = Array.from(new Uint8Array(hashBuffer))
86-
const verificationHash = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
83+
// Create verification hash
84+
const hash = crypto.createHash('sha256');
85+
const hashBuffer = hash.digest(hash.update(fileContent, 'utf8'));
86+
const hashArray = Array.from(new Uint8Array(hashBuffer))
87+
const verificationHash = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
8788

88-
console.log(`New verification FILE NAME: \x1b[36m ${parsedFile.updatedAt}.txt \x1b[0m | HASH: \x1b[36m ${verificationHash}`, '\x1b[0m');
89-
}
89+
console.log(`New verification FILE NAME: \x1b[36m ${parsedFile.updatedAt}.txt \x1b[0m | HASH: \x1b[36m ${verificationHash}`, '\x1b[0m');
90+
}
91+
});
9092
});
91-
});
92-
93+
})()

0 commit comments

Comments
 (0)