Skip to content

Commit 78f8ca4

Browse files
authored
Merge pull request #156 from micromatch/backport-144
[v2] Backport proto fix to v2 #144
2 parents 5467a5a + 3f4f10e commit 78f8ca4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ module.exports = {
9797

9898
// Replace globs with equivalent patterns to reduce parsing time.
9999
REPLACEMENTS: {
100+
__proto__: null,
100101
'***': '*',
101102
'**/**': '**',
102103
'**/**/**': '**'

test/malicious.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ describe('handling of potential regex exploits', () => {
3030
assert(!isMatch('A', `!(${repeat(500)}A)`, { maxLength: 499 }));
3131
}, /Input length: 504, exceeds maximum allowed length: 499/);
3232
});
33+
it('should be able to accept Object instance properties', () => {
34+
assert(isMatch('constructor', 'constructor'), 'valid match');
35+
assert(isMatch('__proto__', '__proto__'), 'valid match');
36+
assert(isMatch('toString', 'toString'), 'valid match');
37+
});
3338
});

0 commit comments

Comments
 (0)