Skip to content

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script... #1489

Closed

Description

@madeupofstardust

Hi. I use Alasql with Teampermonkey, and in certains sites I got this error from console:

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' '*' 'unsafe-inline' *.gstatic.com *.google.com *.googleapis.com *.bootstrapcdn.com".

Looks like the Content Security Policy in many websites doesn't allow to use unsafe eval, so Alasql doesnt't work there.

I tried with this cdns:

https://cdn.jsdelivr.net/alasql/latest/alasql.min.js

https://cdn.jsdelivr.net/npm/alasql

And I got the same error. Is there a way to solve this issue?

Activity

  1. mathiasrw commented on Sep 24, 2022

    @mathiasrw
    Member

    Unsafe eval is the core of how AlaSQL is structured.

    In theory you can alasql.compile what you need and extract the generated function and manage how the function gets the data it needs and then manually move the functions over and use as part of your code instead of AlaSQL, but its not a pleasant experience.

  2. githorse commented on Feb 19, 2024

    @githorse

    Dupllicates #1482.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions