-
Notifications
You must be signed in to change notification settings - Fork 100
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
Code not being encrypted #28
Comments
I solved this by modifying obfuscatingTransformer.js in node_modules\react-native-obfuscating-transformer\dist\ change
to
it seems the author forgot to modify this one. |
@AustinZuniga thanks man that worked perfectly for the individual obfuscated files, however it still seems to have no effect on the overall |
I noticed that one too. Try comparing bundle.js with and without using react-native-obfuscating-transformer. Use a JS code beautifier and diff file tool to see the difference. It seems react-native-obfuscating-transformer is working by obfuscating the code, but the identifier names not turning into hexadecimal or mangled algorithm. Maybe it has something to do with metro transformer |
Yeah I can see from looking at the |
Hi! I tried several set of options with the same result: no obfuscation. I can see some differences between the original bundle and the obfuscated one but essentially nothing about stringsArray or selfDefence for instance. I can see the logs during bundling phase and I get the "obfuscated" files saved alongside the original ones so I assume the module is correctly integrated in metro config. The last configuration I experimented with is identical to the one shown by @dooleyb1 and the result is the same. |
Yep, seeing the same... |
I believe I found the root cause as to why variable / property and function names are not being obfuscated. The docs for javascript-obfuscator/javascript-obfuscator state that Obfuscator.obfuscateMultiple should be called. |
Have you tried changing the |
Not yet, it will take some time to figure out how to map all my flow objects to obfuscateMultiple. |
I won't have time to look into this until late next week (and I can't promise I will have time.) In a nutshell I believe that obfuscateCode.js should be calling Obfuscator.obfuscateMultiple instead of Obfuscator.obfuscate. Another thing to take into consideration is that some RN projects use Flow vs TypeScript. I'd only look into creating a patch that works with Flow, if applicable. |
I still have flow types in a lot of legacy modules for instance. I'll migrate but progressively during functional refactoring not because I have typing issues. |
@filippoitaliano @TraneKJ @AustinZuniga Hey guys, have any of yous managed to get anywhere? Still no luck on my side. |
Nowhere, I'm sorry! I abandoned obfuscation for now. This lib seems to be one of the most comprehensive out there but I didn't manage to make it work. |
No progress, my team had me do a POC with Jscrambler first, which I've done, and it works great, but for a heafty price-tag. |
@dooleyb1 @TraneKJ @filippoitaliano @AustinZuniga Any advise guys? doesn't work for me either |
None yet unfortunately |
@adevfromhere What option did you go with? |
try this plugin https://www.npmjs.com/package/obfuscator-io-metro-plugin |
Can we use the source map generated by the |
@dooleyb1 did you manage to resolve this? If not, did you use an alternative solution? My files don't appear to be obfuscated at all. Original file: const App: React.FC = () => {
const myApiKey = 'foo';
console.log(myApiKey); Obfuscated file: var App = function App() {
var myApiKey = 'foo';
console.log(myApiKey); With the following packages
|
@hannigand No unfortunately I gave up attempting to implement obfuscation on my files and have not re-attempted since. |
I have spent a good while playing around with multiple options and examples and can't seem to get it to work. My setup is the following:
metro.config.js
transformer.js
The command I am using to build the output js bundle for testing is the following:
npx react-native bundle --entry-file=index.js --bundle-output='./bundle.js' --dev=false --platform='ios' --assets-dest='./ios' --reset-cache
I can see the output from stdout of the transformer logging which files are being obfuscated, however when I look at the entire bundle and even the sub obfuscated files, the variable names and function calls are not encrypted.
Below is an example of a before and after obfuscation:
Before (screens.js):
After (screens.obfuscated.js):
The text was updated successfully, but these errors were encountered: