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

RegExp obfuscation #115

Closed
Le0Developer opened this issue Nov 22, 2023 · 2 comments
Closed

RegExp obfuscation #115

Le0Developer opened this issue Nov 22, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Le0Developer
Copy link

Is your feature request related to a problem? Please describe.

Currently regexes are passed through unmodified.

Describe the solution you'd like

Regexes like /ID\d{6}/g should use some of the following obfuscation techniques:

  • transformation to new RegExp syntax (like new RegExp("ID\\d{6}", "g")) - where this transformation happens before string concealing etc
  • group expansions/obfuscation, eg replace \d with [0-9] or [0123456789] or [4753102869] or [91-80] or (?:[0-4]|[5-9]) etc
  • length transformations, eg \d{3}{2} or \d\d\d\d\d\d

No idea for useful static string transformations (like the ID part) yet.

Describe alternatives you've considered

Manually replacing usages of /.../ with new RegExp("...") to enjoy string concealment, however the latter is far more verbose.

Additional context

See also https://docs.jscrambler.com/code-integrity/documentation/transformations/regex-obfuscation

@Le0Developer Le0Developer added the enhancement New feature or request label Nov 22, 2023
@MichaelXF
Copy link
Owner

I think the converting regex literals to new RegExp is the best. Maybe in the future the extra obfuscations could be added

@MichaelXF
Copy link
Owner

Added in 2.0 (Currently 2.0.0-alpha.2). Now simply converts the Regex literal to the RegExp constructor and is further protected by String Concealing / other obfuscations. The extra obfuscations are not planned for now.

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

No branches or pull requests

2 participants