Skip to content

Commit e17dc7c

Browse files
committed
fix(MongoInstance): stdoutHandler: try to apply CodeQL suggestions for CWE-730
1 parent 394ea3a commit e17dc7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,23 +497,24 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
497497
if (/Data directory .*? not found/i.test(line)) {
498498
this.emit(MongoInstanceEvents.instanceError, 'Data directory not found');
499499
}
500-
if (/CURL_OPENSSL_3.*not found/i.test(line)) {
500+
if (/CURL_OPENSSL_3['\s]+not found/i.test(line)) {
501501
this.emit(
502502
MongoInstanceEvents.instanceError,
503503
'libcurl3 is not available on your system. Mongod requires it and cannot be started without it.\n' +
504504
'You should manually install libcurl3 or try to use an newer version of MongoDB\n'
505505
);
506506
}
507-
if (/CURL_OPENSSL_4.*not found/i.test(line)) {
507+
if (/CURL_OPENSSL_4['\s]+not found/i.test(line)) {
508508
this.emit(
509509
MongoInstanceEvents.instanceError,
510510
'libcurl4 is not available on your system. Mongod requires it and cannot be started without it.\n' +
511511
'You need to manually install libcurl4\n'
512512
);
513513
}
514-
if (/lib.*: cannot open shared object/i.test(line)) {
514+
if (/lib[\w-.]+: cannot open shared object/i.test(line)) {
515515
const lib =
516-
line.match(/(lib.*): cannot open shared object/i)?.[1].toLocaleLowerCase() ?? 'unknown';
516+
line.match(/(lib[\w-.]+): cannot open shared object/i)?.[1].toLocaleLowerCase() ??
517+
'unknown';
517518
this.emit(
518519
MongoInstanceEvents.instanceError,
519520
`Instance Failed to start because an library file is missing: "${lib}"`

0 commit comments

Comments
 (0)