Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27606] Android: Remote encryption policy broken in latest 8.3.0

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-11-15T16:49:22.000+0000
Affected Version/sRelease 8.3.0
Fix Version/sRelease 8.3.0
ComponentsAndroid
LabelsengSchedule, regression
ReporterLokesh Choudhary
AssigneeGary Mathews
Created2019-11-14T20:27:21.000+0000
Updated2019-11-15T16:49:22.000+0000

Description

Steps to reproduce:

1. Add the remote encryption policy to the tiapp.xml:
<property name="appc-sourcecode-encryption-policy">remote</property>
2. Build the app for android device/emlator.

Actual results:

1. The app errors with:
[WARN] :   W/om.app.ztest12: resources.arsc in APK '/data/app/com.app.ztest123-9F2WuAtYx4qLJSwTB4tqTQ==/base.apk' is compressed.
[ERROR] :  AssetCryptImpl: (main) [4,4] Security violation detected: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String org.appcelerator.titanium.ITiAppInfo.getId()' on a null object reference
[ERROR] :  AssetCryptImpl: (main) [0,4] Security exception encountered. Waiting for root activity to show error.
[DEBUG] :  APSAnalytics: Initialization started...
[ERROR] :  TiAssetHelper: Error while reading asset "Resources/_app_props_.json":
[ERROR] :  TiAssetHelper: java.io.FileNotFoundException: Resources/_app_props_.json
[ERROR] :  TiAssetHelper:   at android.content.res.AssetManager.nativeOpenAsset(Native Method)
[ERROR] :  TiAssetHelper:   at android.content.res.AssetManager.open(AssetManager.java:744)
[ERROR] :  TiAssetHelper:   at android.content.res.AssetManager.open(AssetManager.java:721)
[ERROR] :  TiAssetHelper:   at org.appcelerator.kroll.util.KrollAssetHelper.readAssetBytes(KrollAssetHelper.java:182)
[ERROR] :  TiAssetHelper:   at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:192)
[ERROR] :  TiAssetHelper:   at org.appcelerator.titanium.TiApplication.loadAppProperties(TiApplication.java:324)
[ERROR] :  TiAssetHelper:   at org.appcelerator.kroll.KrollRuntime.init(KrollRuntime.java:95)
[ERROR] :  TiAssetHelper:   at com.app.ztest123.Ztest123Application.onCreate(Ztest123Application.java:83)
[ERROR] :  TiAssetHelper:   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
[ERROR] :  TiAssetHelper:   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
[ERROR] :  TiAssetHelper:   at android.app.ActivityThread.access$1100(ActivityThread.java:199)
[ERROR] :  TiAssetHelper:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
[ERROR] :  TiAssetHelper:   at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] :  TiAssetHelper:   at android.os.Looper.loop(Looper.java:193)
[ERROR] :  TiAssetHelper:   at android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] :  TiAssetHelper:   at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiAssetHelper:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] :  TiAssetHelper:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[INFO] :   TiApplication: (main) [203,207] Titanium Javascript runtime: v8
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[DEBUG] :  OpenGLRenderer: Skia GL Pipeline
[ERROR] :  AssetCryptImpl: (main) [37,37] Security violation detected: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String org.appcelerator.titanium.ITiAppInfo.getId()' on a null object reference
[ERROR] :  AssetCryptImpl: (main) [0,37] Security exception encountered. Waiting for root activity to show error.
[INFO] :   APSAnalyticsStore: session.start

Expected result:

1. The app should not throw error & remote encryption should work as expected.

Comments

  1. Christopher Williams 2019-11-14

    Looks like a very similar underlying issue as TIMOB-27602, where the internal code to load encrypted assets is barfing on the file path.
  2. Christopher Williams 2019-11-14

    In fact, this looks exactly like the comment from [~ssaddique] in the original PR: https://github.com/appcelerator/titanium_mobile/pull/11045#issuecomment-538944260
  3. Gary Mathews 2019-11-14

    Remote encryption policy in 8.3.0 requires CLI 7.1.2
  4. Lokesh Choudhary 2019-11-14

    I am using 7.1.2-master.5
  5. Gary Mathews 2019-11-14

    8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11337
  6. Lokesh Choudhary 2019-11-15

    FR Passed. Waiting for CR to merge.
  7. Christopher Williams 2019-11-15

    Merged to 8_3_X, cherry-picked to master.
  8. Lokesh Choudhary 2019-11-15

    Verified the fix with SDK 9.0.0.v20191115075819 & 8.3.0.v20191115075757. Closing.

JSON Source