File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
packages/controller-utils Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = merge(baseConfig, {
19
19
global : {
20
20
branches : 77.65 ,
21
21
functions : 81.25 ,
22
- lines : 86.87 ,
22
+ lines : 86.53 ,
23
23
statements : 86.74 ,
24
24
} ,
25
25
} ,
Original file line number Diff line number Diff line change @@ -16,17 +16,23 @@ import { MAX_SAFE_CHAIN_ID } from './constants';
16
16
17
17
const TIMEOUT_ERROR = new Error ( 'timeout' ) ;
18
18
19
- const PROTOTYPE_POLLUTION_BLOCKLIST = [ '__proto__' , 'constructor' ] as const ;
19
+ const PROTOTYPE_POLLUTION_BLOCKLIST = [
20
+ '__proto__' ,
21
+ 'constructor' ,
22
+ 'prototype' ,
23
+ ] as const ;
20
24
21
25
/**
22
- * Checks whether a dynamic string used as an object property key
23
- * could be used in a prototype pollution attack.
26
+ * Checks whether a dynamic property key could be used in
27
+ * a [ prototype pollution attack](https://portswigger.net/web-security/prototype-pollution) .
24
28
*
25
- * @param key - The dynamic key to check for safety .
26
- * @returns Whether the given dyanmic key is safe to use.
29
+ * @param key - The dynamic key to validate .
30
+ * @returns Whether the given dynamic key is safe to use.
27
31
*/
28
32
export function isSafeDynamicKey ( key : string ) : boolean {
29
- return PROTOTYPE_POLLUTION_BLOCKLIST . every ( ( badInput ) => key !== badInput ) ;
33
+ return ! PROTOTYPE_POLLUTION_BLOCKLIST . some (
34
+ ( blockedKey ) => key === blockedKey ,
35
+ ) ;
30
36
}
31
37
32
38
/**
You can’t perform that action at this time.
0 commit comments