Commit 2987e7f
refactor: replace eval with ShadowRealm for safe expression evaluation
Remove dangerous eval() usage in the manual tool execution example and
replace it with ShadowRealm API for secure, isolated JavaScript execution.
ShadowRealm provides a separate realm with its own global object, preventing
access to the host environment's APIs (no DOM, no Node.js APIs, no fetch, etc.),
making it safe for evaluating untrusted expressions.
Includes documentation link to TC39 proposal for contextual education.
Co-Authored-By: Tom Aylott <thomas.42@gmail.com>1 parent b458181 commit 2987e7f
1 file changed
+30
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
166 | 194 | | |
167 | 195 | | |
168 | 196 | | |
| |||
203 | 231 | | |
204 | 232 | | |
205 | 233 | | |
206 | | - | |
207 | | - | |
| 234 | + | |
208 | 235 | | |
209 | | - | |
| 236 | + | |
210 | 237 | | |
211 | 238 | | |
212 | 239 | | |
| |||
0 commit comments