Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module.exports = {

// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
__proto__: null,
'***': '*',
'**/**': '**',
'**/**/**': '**'
Expand Down
5 changes: 5 additions & 0 deletions test/malicious.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ describe('handling of potential regex exploits', () => {
assert(!isMatch('A', `!(${repeat(500)}A)`, { maxLength: 499 }));
}, /Input length: 504, exceeds maximum allowed length: 499/);
});
it('should be able to accept Object instance properties', () => {
assert(isMatch('constructor', 'constructor'), 'valid match');
assert(isMatch('__proto__', '__proto__'), 'valid match');
assert(isMatch('toString', 'toString'), 'valid match');
});
});