MCPcopy
hub / github.com/patriksimek/vm2 / isPathAllowedForModule

Method isPathAllowedForModule

lib/resolver-compat.js:122–132  ·  view source on GitHub ↗
(path, mod)

Source from the content-addressed store, hash-verified

120 }
121
122 isPathAllowedForModule(path, mod) {
123 if (!super.isPathAllowed(path)) return false;
124 if (mod) {
125 if (mod.allowTransitive) return true;
126 if (path.startsWith(mod.path)) {
127 const rem = path.slice(mod.path.length);
128 if (!/(?:^|[\\\\/])node_modules(?:$|[\\\\/])/.test(rem)) return true;
129 }
130 }
131 return this.externals.some(regex => regex.test(path));
132 }
133
134 registerModule(mod, filename, path, parent, direct) {
135 const trustedParent = this.trustedMods.get(parent);

Callers 2

isPathAllowedMethod · 0.95
checkAccessMethod · 0.95

Calls 1

isPathAllowedMethod · 0.45

Tested by

no test coverage detected