This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 758
Watch expressions are easily hijackable #4220
Comments
Oohhh ...Thanks for the report! |
Nice find @Loirooriol, this is a bug with the debugger server. You can see the same issue w/ the old debugger as well. |
Oh, I thought the culprit was #4107 because it wraps the expression in an |
yep, good point... we do the same thing w/ the old debugger client as well. |
so... this fixes it: I think the diff --git a/src/utils/expressions.js b/src/utils/expressions.js
index ec27dac..05e40e1 100644
--- a/src/utils/expressions.js
+++ b/src/utils/expressions.js
@@ -14,13 +14,13 @@ export function sanitizeInput(input: string) {
* NOTE: we add line after the expression to protect against comments.
*/
export function wrapExpression(input: string) {
- return `eval(\`
+ return `
try {
${sanitizeInput(input)}
} catch (e) {
e
}
- \`)`.trim();
+ `.trim();
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
eval = () => 0
1
Result:
0
Expected:
1
The text was updated successfully, but these errors were encountered: