Skip to content

Commit

Permalink
Merge pull request #31 from talsec/fix-ios-bad-access
Browse files Browse the repository at this point in the history
Fix ios bad access issue
  • Loading branch information
xprikryl2 committed May 20, 2024
2 parents 60e3be8 + e904dc6 commit 9a382c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-talsec-plugin-freerasp"
version="6.1.2">
version="6.1.3">

<name>freerasp</name>
<author>Talsec ([email protected])</author>
Expand Down
30 changes: 15 additions & 15 deletions src/ios/TalsecPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}

/**
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit 9a382c3

Please sign in to comment.