Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRITICAL: Dynamic module uses eval #1728

Closed
harshkhandeparkar opened this issue Oct 16, 2020 · 6 comments · Fixed by #1729
Closed

CRITICAL: Dynamic module uses eval #1728

harshkhandeparkar opened this issue Oct 16, 2020 · 6 comments · Fixed by #1729
Labels
help wanted high-priority important security Pull requests that address a security vulnerability

Comments

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Oct 16, 2020

Please describe the problem (or idea)

The dynamic module uses the javascript eval function to evaluate expressions. But the exec method should not be used at any cost because it will execute any js code that is entered in the textbox.

image

This is a major security threat to the IS demo and any other projects that use IS.

Please show us where to look

https://beta.sequencer.publiclab.org

What's your PublicLab.org username?

This can help us diagnose the issue:

Browser, version, and operating system

Many bugs are related to these -- please help us track it down and reproduce what you're seeing!


Thank you!

Your help makes Public Lab better! We deeply appreciate your helping refine and improve this site.

To learn how to write really great issues, which increases the chances they'll be resolved, see:

https://publiclab.org/wiki/developers#Contributing+for+non-coders

@harshkhandeparkar harshkhandeparkar added help wanted important security Pull requests that address a security vulnerability high-priority labels Oct 16, 2020
@jywarren
Copy link
Member

Hi, do you have any ideas for other ways to accomplish this functionality? Thanks!

Could we swap for https://github.com/silentmatt/expr-eval ?

@jywarren
Copy link
Member

function generator(expression) {
var func = 'f = function (r, g, b, a) { var R = r, G = g, B = b, A = a; return ' + expression + ';}';
var f;
eval(func);
return f;
}

could we swapped for:

Also, i think you maybe meant eval and not exec? Thanks Harsh!

@harshkhandeparkar
Copy link
Member Author

Oh yeah sorry, I meant eval.

@harshkhandeparkar harshkhandeparkar changed the title CRITICAL: Dynamic module uses exec CRITICAL: Dynamic module uses eval Oct 17, 2020
@harshkhandeparkar
Copy link
Member Author

Hi, do you have any ideas for other ways to accomplish this functionality? Thanks!

Could we swap for https://github.com/silentmatt/expr-eval ?

I guess there are packages like the one you found. We can switch if it doesn't break anything... What kind of expressions need to be supported though? 🤔

@jywarren
Copy link
Member

It's designed just for simple mathematic expressions to do color channel compositing - so this should be fine!

@jywarren
Copy link
Member

Check out #1729!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted high-priority important security Pull requests that address a security vulnerability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants