Skip to content

Commit fc5584f

Browse files
authored
Merge pull request #8896 from liranmauda/liran-backport-into-5.18
Bumping deps to avoid CVE (16/03/2025)
2 parents c6d7be6 + 44f96dd commit fc5584f

21 files changed

+619
-627
lines changed

package-lock.json

Lines changed: 489 additions & 498 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
]
7272
},
7373
"dependencies": {
74-
"@aws-sdk/client-s3": "3.750.0",
75-
"@aws-sdk/client-sts": "3.750.0",
76-
"@azure/identity": "4.7.0",
74+
"@aws-sdk/client-s3": "3.758.0",
75+
"@aws-sdk/client-sts": "3.758.0",
76+
"@azure/identity": "4.8.0",
7777
"@azure/monitor-query": "1.3.1",
7878
"@azure/storage-blob": "12.26.0",
7979
"@google-cloud/storage": "7.15.2",
@@ -97,41 +97,39 @@
9797
"jsonwebtoken": "9.0.2",
9898
"linux-blockutils": "0.2.0",
9999
"lodash": "4.17.21",
100-
"mime": "3.0.0",
100+
"mime-type": "5.0.2",
101101
"minimist": "1.2.8",
102102
"moment": "2.30.1",
103103
"moment-timezone": "0.5.47",
104104
"mongo-query-to-postgres-jsonb": "0.2.17",
105105
"mongodb": "3.7.4",
106106
"morgan": "1.10.0",
107-
"nan": "2.22.1",
107+
"nan": "2.22.2",
108108
"ncp": "2.0.0",
109109
"node-addon-api": "8.3.1",
110-
"node-rdkafka": "3.3.0",
110+
"node-rdkafka": "3.3.1",
111111
"performance-now": "2.1.0",
112-
"pg": "8.13.3",
112+
"pg": "8.14.0",
113113
"ping": "0.4.4",
114114
"prom-client": "15.1.3",
115115
"ps-node": "0.1.6",
116-
"rimraf": "6.0.1",
117116
"seedrandom": "3.0.5",
118117
"setimmediate": "1.0.5",
119-
"typescript": "5.7.3",
120-
"uuid": "10.0.0",
118+
"typescript": "5.8.2",
121119
"ws": "8.18.1",
122120
"xml2js": "0.6.2",
123121
"yaml": "2.7.0",
124122
"yauzl": "3.2.0",
125123
"yazl": "3.3.1"
126124
},
127125
"devDependencies": {
128-
"@aws-sdk/client-iam": "3.750.0",
129-
"@aws-sdk/lib-storage": "3.750.0",
126+
"@aws-sdk/client-iam": "3.758.0",
127+
"@aws-sdk/lib-storage": "3.758.0",
130128
"@stylistic/eslint-plugin-js": "1.8.1",
131129
"@types/jest": "29.5.14",
132-
"@types/lodash": "4.17.15",
130+
"@types/lodash": "4.17.16",
133131
"@types/mongodb": "4.0.7",
134-
"@types/node": "22.13.5",
132+
"@types/node": "22.13.10",
135133
"@types/pg": "8.11.11",
136134
"eslint": "8.57.1",
137135
"eslint-plugin-header": "3.1.1",

src/agent/agent_cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const os = require('os');
1010
const path = require('path');
1111
const util = require('util');
1212
const repl = require('repl');
13-
const { v4: uuid } = require('uuid');
13+
const crypto = require('crypto');
1414
const argv = require('minimist')(process.argv);
1515
const S3Auth = require('aws-sdk/lib/signers/s3');
1616

@@ -114,7 +114,7 @@ class AgentCLI {
114114
self.client.options.address = self.params.address;
115115
}
116116
if (!self.params.host_id) {
117-
self.params.host_id = uuid();
117+
self.params.host_id = crypto.randomUUID();
118118
return self.agent_conf.update({
119119
host_id: self.params.host_id
120120
});

src/endpoint/blob/ops/blob_put_blob.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const blob_utils = require('../blob_utils');
55
const http_utils = require('../../../util/http_utils');
66
const time_utils = require('../../../util/time_utils');
7-
const mime = require('mime');
7+
const mime = require('mime-types');
88

99

1010
/**
@@ -16,7 +16,7 @@ async function put_blob(req, res) {
1616
const { etag } = await req.object_sdk.upload_object({
1717
bucket: req.params.bucket,
1818
key: req.params.key,
19-
content_type: req.headers['x-ms-blob-content-type'] || (copy_source ? undefined : (mime.getType(req.params.key) || 'application/octet-stream')),
19+
content_type: req.headers['x-ms-blob-content-type'] || (copy_source ? undefined : (mime.lookup(req.params.key) || 'application/octet-stream')),
2020
size: req.content_length >= 0 ? req.content_length : undefined,
2121
md5_b64: req.content_md5 ? req.content_md5.toString('base64') : undefined,
2222
sha256_b64: req.content_sha256_buf ? req.content_sha256_buf.toString('base64') : undefined,

src/endpoint/blob/ops/blob_put_blob_blocklist.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const _ = require('lodash');
55

66
const blob_utils = require('../blob_utils');
77
const http_utils = require('../../../util/http_utils');
8-
const mime = require('mime');
8+
const mime = require('mime-types');
99

1010
/**
1111
* https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-list
@@ -19,7 +19,7 @@ async function put_blob_blocklist(req, res) {
1919
const reply = await req.object_sdk.commit_blob_block_list({
2020
bucket: req.params.bucket,
2121
key: req.params.key,
22-
content_type: req.headers['x-ms-blob-content-type'] || mime.getType(req.params.key) || 'application/octet-stream',
22+
content_type: req.headers['x-ms-blob-content-type'] || mime.lookup(req.params.key) || 'application/octet-stream',
2323
md_conditions: http_utils.get_md_conditions(req),
2424
xattr: blob_utils.get_request_xattr(req),
2525
block_list

src/endpoint/s3/ops/s3_post_object_uploads.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict';
33

44
const s3_utils = require('../s3_utils');
5-
const mime = require('mime');
5+
const mime = require('mime-types');
66
const config = require('../../../../config');
77
const S3Error = require('../s3_errors').S3Error;
88

@@ -21,7 +21,7 @@ async function post_object_uploads(req, res) {
2121
const reply = await req.object_sdk.create_object_upload({
2222
bucket: req.params.bucket,
2323
key: req.params.key,
24-
content_type: req.headers['content-type'] || mime.getType(req.params.key) || 'application/octet-stream',
24+
content_type: req.headers['content-type'] || mime.lookup(req.params.key) || 'application/octet-stream',
2525
content_encoding: req.headers['content-encoding'],
2626
xattr: s3_utils.get_request_xattr(req),
2727
storage_class,

src/endpoint/s3/ops/s3_put_bucket_lifecycle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
const _ = require('lodash');
55
const s3_const = require('../s3_constants');
6-
const { v4: uuid } = require('uuid');
6+
const crypto = require('crypto');
77
const dbg = require('../../../util/debug_module')(__filename);
88
const S3Error = require('../s3_errors').S3Error;
99

@@ -98,13 +98,13 @@ async function put_bucket_lifecycle(req) {
9898
}
9999
} else {
100100
// Generate a random ID if missing
101-
current_rule.id = uuid();
101+
current_rule.id = crypto.randomUUID();
102102
}
103103

104104
// Check for duplicate ID in the rules
105105
if (id_set.has(current_rule.id)) {
106106
dbg.error('Rule ID must be unique. Found same ID for more than one rule: ', current_rule.id);
107-
throw new S3Error({ ...S3Error.InvalidArgument, message: 'Rule ID must be unique. Found same ID for more than one rule'});
107+
throw new S3Error({ ...S3Error.InvalidArgument, message: 'Rule ID must be unique. Found same ID for more than one rule' });
108108
}
109109
id_set.add(current_rule.id);
110110

src/endpoint/s3/ops/s3_put_object.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const dbg = require('../../../util/debug_module')(__filename);
55
const s3_utils = require('../s3_utils');
66
const S3Error = require('../s3_errors').S3Error;
77
const http_utils = require('../../../util/http_utils');
8-
const mime = require('mime');
8+
const mime = require('mime-types');
99
const config = require('../../../../config');
1010

1111
const s3_error_options = {
@@ -41,7 +41,7 @@ async function put_object(req, res) {
4141
const reply = await req.object_sdk.upload_object({
4242
bucket: req.params.bucket,
4343
key: req.params.key,
44-
content_type: req.headers['content-type'] || (copy_source ? undefined : (mime.getType(req.params.key) || 'application/octet-stream')),
44+
content_type: req.headers['content-type'] || (copy_source ? undefined : (mime.lookup(req.params.key) || 'application/octet-stream')),
4545
content_encoding: req.headers['content-encoding'],
4646
copy_source,
4747
source_stream,

src/hosted_agents/hosted_agents.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Copyright (C) 2016 NooBaa */
22
'use strict';
33

4-
const { v4: uuid } = require('uuid');
4+
const crypto = require('crypto');
55
const path = require('path');
66
const util = require('util');
77
const fs = require('fs');
@@ -197,7 +197,7 @@ class HostedAgents {
197197
start_local_agent(params) {
198198
if (!this._started) return;
199199

200-
const host_id = uuid();
200+
const host_id = crypto.randomUUID();
201201
const node_name = 'noobaa-internal-agent-' + params.name;
202202
const storage_path = path.join(process.cwd(), 'noobaa_storage', node_name);
203203

src/sdk/endpoint_stats_collector.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
'use strict';
33

44
const _ = require('lodash');
5-
const mime = require('mime');
5+
const mime = require('mime-types');
66

77
const dbg = require('../util/debug_module')(__filename);
88
const prom_report = require('../server/analytic_services/prometheus_reporting');
99
const stats_aggregator = require('../server/system_services/stats_aggregator');
1010
const DelayedCollector = require('../util/delayed_collector');
1111
const config = require('../../config');
1212
const cluster = /** @type {import('node:cluster').Cluster} */ (
13-
/** @type {unknown} */ (require('node:cluster'))
13+
/** @type {unknown} */
14+
(require('node:cluster'))
1415
);
1516

1617
/**
@@ -239,16 +240,20 @@ class EndpointStatsCollector {
239240
}
240241

241242
update_bucket_read_counters({ bucket_name, key, content_type, }) {
242-
content_type = content_type || mime.getType(key) || 'application/octet-stream';
243+
content_type = content_type || mime.lookup(key) || 'application/octet-stream';
243244
this.endpoint_stats_collector.update({
244-
bucket_counters: { [bucket_name]: { [content_type]: { read_count: 1 } } }
245+
bucket_counters: {
246+
[bucket_name]: {
247+
[content_type]: { read_count: 1 } } }
245248
});
246249
}
247250

248251
update_bucket_write_counters({ bucket_name, key, content_type, }) {
249-
content_type = content_type || mime.getType(key) || 'application/octet-stream';
252+
content_type = content_type || mime.lookup(key) || 'application/octet-stream';
250253
this.endpoint_stats_collector.update({
251-
bucket_counters: { [bucket_name]: { [content_type]: { write_count: 1 } } }
254+
bucket_counters: {
255+
[bucket_name]: {
256+
[content_type]: { write_count: 1 } } }
252257
});
253258
}
254259

@@ -361,7 +366,7 @@ class EndpointStatsCollector {
361366
update_fork_counter() {
362367
// add fork related metrics to prometheus
363368
const code = `worker_${cluster.worker.id}`;
364-
this.prom_metrics_report.inc('fork_counter', {code});
369+
this.prom_metrics_report.inc('fork_counter', { code });
365370
}
366371
}
367372
if (cluster.isWorker) {

0 commit comments

Comments
 (0)