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

Content Security Policy (CSP) issues with new Function(...) #472

Open
michael98123 opened this issue Nov 28, 2022 · 2 comments
Open

Content Security Policy (CSP) issues with new Function(...) #472

michael98123 opened this issue Nov 28, 2022 · 2 comments

Comments

@michael98123
Copy link

the usage of "new Function()" requires to increase the CSP to 'unsafe-eval'

code:

function tryConvertExpr(string) {
    // PENDING
    var exprRes = /^expr\((.*)\)$/.exec(string);
    if (exprRes) {
        try {
            var func = new Function('width', 'height', 'dpr', 'return ' + exprRes[1]);
            // Try run t
            func(1, 1);

            return func;
        }
        catch (e) {
            throw new Error('Invalid expression.');
        }
    }
}

Please replace the usage(s) of new Function with safer methods

@setvik
Copy link

setvik commented Oct 4, 2023

Ditto. This is a security issue and blocker for us.

@setvik
Copy link

setvik commented Oct 5, 2023

Update: the code is actually in a dependency of echarts-gl, claygl.

The insecure code is here:
https://github.com/pissang/claygl/blob/master/src/createCompositor.js#L294

Related issue in that repository is here:
pissang/claygl#133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants