Commit ac9599a
tools: report unsafe string and regex primordials as lint errors
| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
`RegExp.prototype[Symbol.replace]` and `RegExp.prototype[Symbol.split]`
are still allowed for a lack of a better solution.
PR-URL: #43393
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 0bb84b0 commit ac9599aCopy full SHA for ac9599a
File tree
Expand file treeCollapse file tree
4 files changed
+98
-17
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
- tools/eslint-rules
Expand file treeCollapse file tree
4 files changed
+98
-17
lines changedOpen diff view settings
Collapse file
+16-16Lines changed: 16 additions & 16 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | | - |
| 30 | + |
31 | 31 | |
32 | 32 | |
33 | 33 | |
| ||
134 | 134 | |
135 | 135 | |
136 | 136 | |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | | - |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
152 | 152 | |
153 | 153 | |
154 | 154 | |
|
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
535 | 535 | |
536 | 536 | |
537 | 537 | |
538 | | - |
| 538 | + |
539 | 539 | |
540 | 540 | |
541 | 541 | |
|
Collapse file
test/parallel/test-eslint-avoid-prototype-pollution.js
Copy file name to clipboardExpand all lines: test/parallel/test-eslint-avoid-prototype-pollution.js+40Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
143 | 143 | |
144 | 144 | |
145 | 145 | |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
146 | 186 | |
147 | 187 | |
Collapse file
tools/eslint-rules/avoid-prototype-pollution.js
Copy file name to clipboardExpand all lines: tools/eslint-rules/avoid-prototype-pollution.js+41Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
63 | 63 | |
64 | 64 | |
65 | 65 | |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
66 | 77 | |
67 | 78 | |
68 | 79 | |
| ||
87 | 98 | |
88 | 99 | |
89 | 100 | |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
90 | 131 | |
91 | 132 | |
92 | 133 | |
0 commit comments