Skip to content

Commit c6390b7

Browse files
committed
fix: vulnerability
1 parent 603297a commit c6390b7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

bin/testObservability/helper/constants.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ exports.OBSERVABILITY_ENV_VARS = [
3030
];
3131

3232
exports.TEST_OBSERVABILITY_REPORTER = path.join(__dirname, '..', 'reporter');
33+
34+
exports.ALLOWED_MODULES = [
35+
'cypress/package.json',
36+
'mocha/lib/reporters/base.js',
37+
'mocha/lib/utils.js',
38+
'mocha'
39+
]

bin/testObservability/helper/helper.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const GLOBAL_MODULE_PATH = execSync('npm root -g').toString().trim();
2525
const { name, version } = require('../../../package.json');
2626

2727
const { CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS } = require('../../helpers/constants');
28-
const { consoleHolder, API_URL, TEST_OBSERVABILITY_REPORTER } = require('./constants');
28+
const { consoleHolder, API_URL, TEST_OBSERVABILITY_REPORTER, ALLOWED_MODULES } = require('./constants');
2929
exports.pending_test_uploads = {
3030
count: 0
3131
};
@@ -725,6 +725,10 @@ exports.requireModule = (module, _package) => {
725725
};
726726

727727
exports.resolveModule = (module, _package = null) => {
728+
if (!ALLOWED_MODULES.includes(module)) {
729+
throw new Error('Invalid module name');
730+
}
731+
728732
if (_package) {
729733
try {
730734
const fileSeparator = path.sep;

0 commit comments

Comments
 (0)