Skip to content

Cannot combine selfDefending and target: browser-no-eval #610

Closed

Description

@patriksletmo

The self defending template relies on constructing a new function, which is incompatible in environments that prevents eval-like functionality from running, for example when using a strict CSP. Normally, one would use target: "browser-no-eval" to prevent eval-like functionality from being included in the output, but selfDefending: true will be applied even though this target is chosen.

Expected Behavior

I see two possible options here:

  1. The configuration validation fails and notifies the user that these two options are incompatible with each other
  2. The self defending template is updated to be compatible with the browser-no-eval target

Current Behavior

The application ignores that the two options are incompatible with each other and outputs eval-like code even though eval-like behavior has been opted out by the user.

Steps to Reproduce

  1. Use the following configuration:
{
  "target": "browser-no-eval",
  "selfDefending": true
}
  1. Obfuscate a piece of Javascript
  2. Serve the Javascript from a site with a strict script-src Content Security Policy
  3. Observe that the script fails to load

Your Environment

  • Obfuscator version used: 0.28.2
  • Node version used: 13.12.0

Activity

  1. sanex3339 commented on May 31, 2020

    @sanex3339
    Member

    Will fix it soon by adding a separate code for self-defending with browser-no-eval. It will more noticeable, but this is a cost.

  2. sanex3339 commented on May 31, 2020

    @sanex3339
    Member

    Released as 0.28.4. Please try it and create another issue if the problem still here.

  3. patriksletmo commented on Jun 1, 2020

    @patriksletmo
    Author

    Awesome, thank you!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions