From 66193bb36a2f0e84233f1005c36ee0613e412337 Mon Sep 17 00:00:00 2001 From: Tomas Psota Date: Mon, 20 May 2024 09:36:20 +0200 Subject: [PATCH 1/2] fix(iOS): resolve bad access error --- src/ios/TalsecPlugin.swift | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ios/TalsecPlugin.swift b/src/ios/TalsecPlugin.swift index b0fa8e3..45ea551 100644 --- a/src/ios/TalsecPlugin.swift +++ b/src/ios/TalsecPlugin.swift @@ -3,14 +3,10 @@ import TalsecRuntime @objc(TalsecPlugin) class TalsecPlugin : CDVPlugin { public static var shared:TalsecPlugin? - var threatIdentifierList: [Int] = (1...12).map { _ in Int.random(in: 100_000..<999_999_999) } override func pluginInitialize() { TalsecContext.context.commandDelegate = self.commandDelegate TalsecPlugin.shared = self - if (threatIdentifierList == nil) { - threatIdentifierList = (1...12).map { _ in Int.random(in: 100_000..<999_999_999) } - } } /** @@ -135,32 +131,36 @@ class TalsecContext : CDVPlugin { } } +struct ThreatIdentifiers { + static let threatIdentifierList: [Int] = (1...12).map { _ in Int.random(in: 100_000..<999_999_999) } +} + /// An extension to unify callback names with Cordova ones. extension SecurityThreat { var callbackIdentifier: Int { switch self { case .signature: - return TalsecPlugin.shared!.threatIdentifierList[0] + return ThreatIdentifiers.threatIdentifierList[0] case .jailbreak: - return TalsecPlugin.shared!.threatIdentifierList[1] + return ThreatIdentifiers.threatIdentifierList[1] case .debugger: - return TalsecPlugin.shared!.threatIdentifierList[2] + return ThreatIdentifiers.threatIdentifierList[2] case .runtimeManipulation: - return TalsecPlugin.shared!.threatIdentifierList[3] + return ThreatIdentifiers.threatIdentifierList[3] case .passcode: - return TalsecPlugin.shared!.threatIdentifierList[4] + return ThreatIdentifiers.threatIdentifierList[4] case .passcodeChange: - return TalsecPlugin.shared!.threatIdentifierList[5] + return ThreatIdentifiers.threatIdentifierList[5] case .simulator: - return TalsecPlugin.shared!.threatIdentifierList[6] + return ThreatIdentifiers.threatIdentifierList[6] case .missingSecureEnclave: - return TalsecPlugin.shared!.threatIdentifierList[7] + return ThreatIdentifiers.threatIdentifierList[7] case .deviceChange: - return TalsecPlugin.shared!.threatIdentifierList[8] + return ThreatIdentifiers.threatIdentifierList[8] case .deviceID: - return TalsecPlugin.shared!.threatIdentifierList[9] + return ThreatIdentifiers.threatIdentifierList[9] case .unofficialStore: - return TalsecPlugin.shared!.threatIdentifierList[10] + return ThreatIdentifiers.threatIdentifierList[10] @unknown default: abort() } From e904dc676f3799e09ff1af8d587ad551e0ae7368 Mon Sep 17 00:00:00 2001 From: Tomas Psota Date: Mon, 20 May 2024 09:39:18 +0200 Subject: [PATCH 2/2] chore(release): freeRASP 6.1.3 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- plugin.xml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8832f24..6bf03f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# freeRASP 6.1.3 + +### iOS + +- ⚡ Fixed BAD_ACCESS error occurring in specific versions of `cordova-ios` plugin ([#28](https://github.com/talsec/Free-RASP-Cordova/issues/28)) + # freeRASP 6.1.2 ### Android diff --git a/package.json b/package.json index 15f1c3a..a9f858c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-talsec-plugin-freerasp", - "version": "6.1.2", + "version": "6.1.3", "description": "Cordova plugin for improving app security and threat monitoring on Android and iOS mobile devices.", "cordova": { "id": "cordova-talsec-plugin-freerasp", diff --git a/plugin.xml b/plugin.xml index 0248f42..a686da7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="6.1.3"> freerasp Talsec (info@talsec.app)