[TIMOB-7553] Android: Source code protection needs to be implemented for Android on V8
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-13T13:48:21.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Release 2.0.0, Release 1.8.2, Sprint 2012-06 |
Components | Android |
Labels | dr-list |
Reporter | Kevin Whinnery |
Assignee | Josh Roesslein |
Created | 2012-02-06T13:43:34.000+0000 |
Updated | 2017-03-16T22:08:02.000+0000 |
Description
Source code is shipped as obfuscated source in Titanium applications for Android. This results in application logic that is significantly easier to reverse engineer. Suggest that similar measures be taken at build time as iOS, where JavaScript code is inlined in a C file and compiled into the application.
Test cases
Create or import a project to use during these tests.Running application (without protection enabled)
1. Install application to a device. 2. Launch application and verify it works (no file not found errors). 3. Rununzip -l build/android/app.apk
4. Verify in assets/Resources you can see your JavaScript files.
Running application (with protection enabled)
1. In tiapp.xml add a property with name "ti.android.compilejs" set to true. 2. Install application to device. 3. Launch application and verify it works. 4. Rununzip -l build/android/app.apk
5. Verify in assets/Resources there is no JavaScript files.
Deploy application (protection enabled by default)
1. Create a deploy APK from Studio. 2. Rununzip -l app.apk
3. Verify no JavaScript files exist under assets/Resources
4. Install APK to device and verify application works.
To me this is a good place to start, keeping honest people honest.
thanks for working this one so quickly Josh!
Does this resolve the problem for BOTH v8 and rhino targets?
Rhino didn't have this problem to start with.
Neeraj, you can split words all you want, but as it is now, in 1.8.1, if you choose V8 OR rhino in your TIAPP.xml, your tail end is hanging in the wind if you release an android app. Original source code packaged up nice and neat for thieving. It may be a bit obfuscated, not nothing an online tool or two can't clean up. So, I'll ask again. Does this resolve the problem for BOTH V8 and rhino targets? At this point in time, EVERY release APK coming out of 1.8.1 in Titanium has the source code out in the open.
Stephen - Let me rephrase my earlier comment. Rhino already had the mechanism that we implemented recently for V8 to protect the source code. Therefore, an application no longer has to rely on obfuscation for either V8 or Rhino runtime option. Try it out with the latest master or 1.8.2 CI build for both the runtimes and let us know if you see any problem.
I don't think this issue is well solved. I built a project by "distribute to Android marketplace" with 1.8.2 formal release. The internal javascript files are only BASE64 strings in AssetCryptImpl.java file. The javascript source can be easily decoded. Compared to the decompiled java class files, these javascript files are more easily understandable. Do I miss anything? Or what's wrong with my steps to build a project?
The new source code protection step seems to have an issue with large javascript files. I'm using 126kByte large javascript oo framework (qooxdoo) which breaks the compilation step if property ti.android.compilejs is set to true. Others reported this as well in Q&A: http://developer.appcelerator.com/question/133073/jquery-doesnt-work-after-deploying-to-android-market http://developer.appcelerator.com/question/133006/constant-string-too-long The error message is:
Please consider enlarging the obviously limited maximum file/string lentgh.
@Kevin: wouldn't it be better to change the obfuscator with an automatism which decides on file length if the file is suitable for obfuscation? A warning should state something like "max. file size for obfuscation exceeded: packaging unobfuscated". Or even better: increase the limit (where ever it may be) so large files are also processed?
Sent [Pull Request #1648](https://github.com/appcelerator/titanium_mobile/pull/1648) to fix build errors with large JavaScript files.
Which version of Mobile SDK does/will contain this fix? I can't read that from Josh's [Pull Request #1648](https://github.com/appcelerator/titanium_mobile/pull/1648).
Release 2.1.0
It is working well in the 2.1.0 builds now.
Closing ticket as fixed.