Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27948] Android: Use of wrong string operator in string comparison in TiJSService

GitHub Issuen/a
TypeStory
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2020-11-23T22:01:23.000+0000
Affected Version/sRelease 8.3.1, Release 9.0.2, Release 9.1.0
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsn/a
ReporterEwan Harris
AssigneeJoshua Quick
Created2020-06-08T17:19:43.000+0000
Updated2020-11-23T22:01:23.000+0000

Description

Description

In [TiJSService](https://github.com/appcelerator/titanium_mobile/blob/4336b21ef89ac8745a4de318e66f3d9c5f8d7fb1/android/modules/android/src/java/ti/modules/titanium/android/TiJSService.java#L59) we use the != operator to compare a string, this should be updated to use .equals() as this can be flagged by some security scans. Note that this is a minor issue as the code path is only active when debug logging is enabled

Comments

  1. Joshua Quick 2020-06-09

    Unfortunately our Java checkstyle tool won't trigger a build failure when doing string variable reference equals/not-equals like this. It only checks string "literal" reference equality. https://checkstyle.sourceforge.io/config_coding.html#StringLiteralEquality
  2. Joshua Quick 2020-10-08

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12166
  3. Satyam Sekhri 2020-11-23

    Verified on: Mac OS: 10.15.4 SDK: 9.3.0.v20201123121926 Appc CLI: 8.1.1 JDK: 11.0.6 Node: 12.16.1 Studio: 6.0.0.202005141803 Device: Pixel 3 XL(v11.0) emulator

JSON Source