Free-RASP-Cordova icon indicating copy to clipboard operation
Free-RASP-Cordova copied to clipboard

App Not Working after install this plugin on iOS 14

Open iPMisterX opened this issue 1 year ago • 4 comments

Describe the bug Not working on iOS 14 maybe on iOS 13 too

To Reproduce

cordova platform add [email protected]
cordova plugin add cordova-plugin-add-swift-support --save
cordova plugin add cordova-talsec-plugin-freerasp

Expected behavior Blank Project cordova create hello com.example.hello HelloWorld with cordova plugin add cordova-plugin-add-swift-support --save

IMG_0012

2025-01-13 16:57:07.090425+0700 HelloWorld[29184:8363713] Apache Cordova iOS platform version 7.1.1 is starting.
2025-01-13 16:57:07.098477+0700 HelloWorld[29184:8363713] Could not load the "LaunchStoryboard" image referenced from a nib in the bundle with identifier "com.example.hello"
2025-01-13 16:57:07.206361+0700 HelloWorld[29184:8363713] The preference key "AllowNewWindows" is not defined and will default to "FALSE"
2025-01-13 16:57:07.207712+0700 HelloWorld[29184:8363713] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE"
2025-01-13 16:57:07.207792+0700 HelloWorld[29184:8363713] The preference key "LimitsNavigationsToAppBoundDomains" is not defined and will default to "FALSE"
2025-01-13 16:57:07.211766+0700 HelloWorld[29184:8363713] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE"
2025-01-13 16:57:07.211814+0700 HelloWorld[29184:8363713] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE"
2025-01-13 16:57:07.211836+0700 HelloWorld[29184:8363713] CDVWebViewEngine will reload WKWebView if required on resume
2025-01-13 16:57:07.211858+0700 HelloWorld[29184:8363713] Using WKWebView
2025-01-13 16:57:07.212145+0700 HelloWorld[29184:8363713] [CDVTimer][console] 0.038981ms
2025-01-13 16:57:07.212218+0700 HelloWorld[29184:8363713] [CDVTimer][handleopenurl] 0.030994ms
2025-01-13 16:57:07.212782+0700 HelloWorld[29184:8363713] [CDVTimer][intentandnavigationfilter] 0.535011ms
2025-01-13 16:57:07.212845+0700 HelloWorld[29184:8363713] [CDVTimer][gesturehandler] 0.023961ms
2025-01-13 16:57:07.212875+0700 HelloWorld[29184:8363713] [CDVTimer][TotalPluginStartup] 0.813961ms
2025-01-13 16:57:07.287858+0700 HelloWorld[29184:8363713] WF: === Starting WebFilter logging for process HelloWorld
2025-01-13 16:57:07.287906+0700 HelloWorld[29184:8363713] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2025-01-13 16:57:07.287937+0700 HelloWorld[29184:8363713] WF: _WebFilterIsActive returning: NO
2025-01-13 16:57:07.449108+0700 HelloWorld[29184:8363713] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"
2025-01-13 16:57:07.456579+0700 HelloWorld[29184:8363713] Running [email protected]

After install cordova-talsec-plugin-freerasp App Not Working

hello % cordova plugin add cordova-talsec-plugin-freerasp
Installing "cordova-talsec-plugin-freerasp" for ios
Adding cordova-talsec-plugin-freerasp to package.json
Importing TalsecBridging-Header.h into /hello/platforms/ios/HelloWorld/Bridging-Header.h

IMG_0013

2025-01-13 17:01:03.413040+0700 HelloWorld[29230:8365745] Apache Cordova iOS platform version 7.1.1 is starting.
2025-01-13 17:01:03.421714+0700 HelloWorld[29230:8365745] Could not load the "LaunchStoryboard" image referenced from a nib in the bundle with identifier "com.example.hello"
2025-01-13 17:01:03.547244+0700 HelloWorld[29230:8365745] The preference key "AllowNewWindows" is not defined and will default to "FALSE"
2025-01-13 17:01:03.548714+0700 HelloWorld[29230:8365745] The preference key "MediaPlaybackAllowsAirPlay" is not defined and will default to "TRUE"
2025-01-13 17:01:03.548793+0700 HelloWorld[29230:8365745] The preference key "LimitsNavigationsToAppBoundDomains" is not defined and will default to "FALSE"
2025-01-13 17:01:03.553127+0700 HelloWorld[29230:8365745] The preference key "AllowBackForwardNavigationGestures" is not defined and will default to "FALSE"
2025-01-13 17:01:03.553179+0700 HelloWorld[29230:8365745] The preference key "Allow3DTouchLinkPreview" is not defined and will default to "TRUE"
2025-01-13 17:01:03.553201+0700 HelloWorld[29230:8365745] CDVWebViewEngine will reload WKWebView if required on resume
2025-01-13 17:01:03.553227+0700 HelloWorld[29230:8365745] Using WKWebView
2025-01-13 17:01:03.553476+0700 HelloWorld[29230:8365745] [CDVTimer][console] 0.035048ms
2025-01-13 17:01:03.553551+0700 HelloWorld[29230:8365745] [CDVTimer][handleopenurl] 0.035048ms
2025-01-13 17:01:03.554069+0700 HelloWorld[29230:8365745] [CDVTimer][intentandnavigationfilter] 0.488997ms
2025-01-13 17:01:03.554135+0700 HelloWorld[29230:8365745] [CDVTimer][gesturehandler] 0.026107ms
2025-01-13 17:01:03.554165+0700 HelloWorld[29230:8365745] [CDVTimer][TotalPluginStartup] 0.765920ms
2025-01-13 17:01:03.645548+0700 HelloWorld[29230:8365745] WF: === Starting WebFilter logging for process HelloWorld
2025-01-13 17:01:03.645592+0700 HelloWorld[29230:8365745] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2025-01-13 17:01:03.645622+0700 HelloWorld[29230:8365745] WF: _WebFilterIsActive returning: NO
2025-01-13 17:01:03.831216+0700 HelloWorld[29230:8365745] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE"

Please complete the following information:

  • Device: iPhone X, iPad 5
  • OS version: iOS 14.3
  • Version of freeRASP: 7.3.0

Additional context iOS 15, 16, 17, 18 Working fine Test on Simulator Screenshot 2568-01-13 at 17 14 12

iPMisterX avatar Jan 13 '25 10:01 iPMisterX

iOS 14/13 Working fine with freeRASP: 5.4.0 But if upgrade to 6.0.0 or upper App not working after install plugin

iPMisterX avatar Jan 13 '25 10:01 iPMisterX

Temporary solution for this problem. i use BabelJS Javascript Transpiler your www/talsec.js files to ES5

now my app working fine on iOS 14 with RASP: 7.3.0 (ES5 talsec.js)

iPMisterX avatar Jan 14 '25 08:01 iPMisterX

Hi @iPMisterX,

We use esnext as the target for compiling JavaScript files. So far we did not encounter any issues, however I suspect the error could be caused by some missing polyfill. Based on the provided data, I do not see any error logs indicating a problem with the freerasp plugin. Do you get any error logs in the console, and could you share them?

Thanks, Tomas

tompsota avatar Jan 14 '25 09:01 tompsota

I think the problem is Static class fields support iOS 14.5 and above. https://caniuse.com/?search=JavaScript%20classes%3A%20Static%20class%20fields https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#browser_compatibility IMG_0014

My app working after replace your script class Threat by using BabelJS

class Threat {
  value;
  static AppIntegrity = new Threat(0);
  static PrivilegedAccess = new Threat(0);
  static Debug = new Threat(0);
  static Hooks = new Threat(0);
  static Passcode = new Threat(0);
  static Simulator = new Threat(0);
  static SecureHardwareNotAvailable = new Threat(0);
  static SystemVPN = new Threat(0);
  static DeviceBinding = new Threat(0);
  static DeviceID = new Threat(0);
  static UnofficialStore = new Threat(0);
  static ObfuscationIssues = new Threat(0);
  static DevMode = new Threat(0);
  static Malware = new Threat(0);
  static ADBEnabled = new Threat(0);
  constructor(value) {
    this.value = value;
  }
  static getValues = () => {
    return cordova.platformId === 'android'
      ? [
          this.AppIntegrity,
          this.PrivilegedAccess,
          this.Debug,
          this.Hooks,
          this.Passcode,
          this.Simulator,
          this.SecureHardwareNotAvailable,
          this.SystemVPN,
          this.DeviceBinding,
          this.UnofficialStore,
          this.ObfuscationIssues,
          this.DevMode,
          this.Malware,
          this.ADBEnabled,
        ]
      : [
          this.AppIntegrity,
          this.PrivilegedAccess,
          this.Debug,
          this.Hooks,
          this.Passcode,
          this.Simulator,
          this.SecureHardwareNotAvailable,
          this.SystemVPN,
          this.DeviceBinding,
          this.DeviceID,
          this.UnofficialStore,
        ];
  };
}
var _Threat;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var Threat = /*#__PURE__*/_createClass(function Threat(value) {
  _classCallCheck(this, Threat);
  _defineProperty(this, "value", void 0);
  this.value = value;
});
_Threat = Threat;
_defineProperty(Threat, "AppIntegrity", new _Threat(0));
_defineProperty(Threat, "PrivilegedAccess", new _Threat(0));
_defineProperty(Threat, "Debug", new _Threat(0));
_defineProperty(Threat, "Hooks", new _Threat(0));
_defineProperty(Threat, "Passcode", new _Threat(0));
_defineProperty(Threat, "Simulator", new _Threat(0));
_defineProperty(Threat, "SecureHardwareNotAvailable", new _Threat(0));
_defineProperty(Threat, "SystemVPN", new _Threat(0));
_defineProperty(Threat, "DeviceBinding", new _Threat(0));
_defineProperty(Threat, "DeviceID", new _Threat(0));
_defineProperty(Threat, "UnofficialStore", new _Threat(0));
_defineProperty(Threat, "ObfuscationIssues", new _Threat(0));
_defineProperty(Threat, "DevMode", new _Threat(0));
_defineProperty(Threat, "Malware", new _Threat(0));
_defineProperty(Threat, "ADBEnabled", new _Threat(0));
_defineProperty(Threat, "getValues", function () {
  return cordova.platformId === "android"
    ? [
        _Threat.AppIntegrity,
        _Threat.PrivilegedAccess,
        _Threat.Debug,
        _Threat.Hooks,
        _Threat.Passcode,
        _Threat.Simulator,
        _Threat.SecureHardwareNotAvailable,
        _Threat.SystemVPN,
        _Threat.DeviceBinding,
        _Threat.UnofficialStore,
        _Threat.ObfuscationIssues,
        _Threat.DevMode,
        _Threat.Malware,
        _Threat.ADBEnabled
      ]
    : [
        _Threat.AppIntegrity,
        _Threat.PrivilegedAccess,
        _Threat.Debug,
        _Threat.Hooks,
        _Threat.Passcode,
        _Threat.Simulator,
        _Threat.SecureHardwareNotAvailable,
        _Threat.SystemVPN,
        _Threat.DeviceBinding,
        _Threat.DeviceID,
        _Threat.UnofficialStore
      ];
});

iPMisterX avatar Jan 15 '25 05:01 iPMisterX

Hello,

Currently, we don't have plans to change to BabelJS - you will need to recompile the files on your end for now. I'm closing this ticket for now. Feel free to reopen it, if necessary.

Regards, Tomas

tompsota avatar Jul 29 '25 12:07 tompsota