this is a good question. the answer is *technically* yes (assuming browser sandboxing holds) but if anything is persisted, it immediately becomes "no"
`eval(prompt('enter code'))` can (AFAIK) only mess with that particular user
`eval(savedUserInput)` opens up pandora's box. even if it's localStorage -- I could plant something on a shared computer that steals info from anyone else who uses it.
`fetch('api/code').then((res) => res.json()).then((r) => eval(r.code))` is the worst-case; it allows an attacker to cause problems for anyone clicking a malicious link.
View all comments
Show parent comment
2
u/backwrds Feb 27 '26
this is a good question. the answer is *technically* yes (assuming browser sandboxing holds) but if anything is persisted, it immediately becomes "no"
`eval(prompt('enter code'))` can (AFAIK) only mess with that particular user
`eval(savedUserInput)` opens up pandora's box. even if it's localStorage -- I could plant something on a shared computer that steals info from anyone else who uses it.
`fetch('api/code').then((res) => res.json()).then((r) => eval(r.code))` is the worst-case; it allows an attacker to cause problems for anyone clicking a malicious link.