Commit 111beea
committed
Fixed Function constructor template injection.
The Function constructor uses a `(function(<args>) {<body>})` template
to construct new functions. This approach was vulnerable to template
injection where malicious code could close the function body early and
ignore the trailing brackets using // comments.
The fix is to insert extra newlines into the template, which prevents //
comments from commenting out the remaining template.
This fixes issue #921.1 parent f1aa752 commit 111beea
2 files changed
Lines changed: 17 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1049 | 1049 | | |
1050 | 1050 | | |
1051 | 1051 | | |
1052 | | - | |
| 1052 | + | |
1053 | 1053 | | |
1054 | 1054 | | |
1055 | 1055 | | |
| |||
1058 | 1058 | | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | | - | |
| 1061 | + | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
| |||
1125 | 1125 | | |
1126 | 1126 | | |
1127 | 1127 | | |
1128 | | - | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1129 | 1132 | | |
1130 | 1133 | | |
1131 | 1134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14189 | 14189 | | |
14190 | 14190 | | |
14191 | 14191 | | |
14192 | | - | |
| 14192 | + | |
14193 | 14193 | | |
14194 | 14194 | | |
14195 | | - | |
| 14195 | + | |
14196 | 14196 | | |
14197 | 14197 | | |
14198 | | - | |
| 14198 | + | |
14199 | 14199 | | |
14200 | 14200 | | |
14201 | 14201 | | |
14202 | 14202 | | |
14203 | 14203 | | |
14204 | | - | |
| 14204 | + | |
14205 | 14205 | | |
14206 | 14206 | | |
14207 | | - | |
| 14207 | + | |
14208 | 14208 | | |
14209 | 14209 | | |
14210 | 14210 | | |
| |||
14216 | 14216 | | |
14217 | 14217 | | |
14218 | 14218 | | |
14219 | | - | |
| 14219 | + | |
14220 | 14220 | | |
14221 | 14221 | | |
14222 | 14222 | | |
| |||
14282 | 14282 | | |
14283 | 14283 | | |
14284 | 14284 | | |
14285 | | - | |
| 14285 | + | |
| 14286 | + | |
| 14287 | + | |
| 14288 | + | |
14286 | 14289 | | |
14287 | 14290 | | |
14288 | 14291 | | |
| |||
19811 | 19814 | | |
19812 | 19815 | | |
19813 | 19816 | | |
19814 | | - | |
| 19817 | + | |
19815 | 19818 | | |
19816 | 19819 | | |
19817 | 19820 | | |
| |||
0 commit comments