Skip to content

Commit 32c57d8

Browse files
wip(core): moduleCache bust be a prototype-less object
1 parent 642ff24 commit 32c57d8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ export async function loadModule(path : string, options : Options = throwNotDefi
119119
getResource = defaultGetResource,
120120
} = options;
121121

122+
// moduleCache should be defined with Object.create(null). require('constructor') etc... should not be a default module
123+
if ( moduleCache instanceof Object )
124+
Object.setPrototypeOf(moduleCache, null);
122125

123126
// TBD: remove this in v1.0
124127
async function normalizedGetFile(path : string) : Promise<File> {

0 commit comments

Comments
 (0)