capacitor-freerasp 2.2.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/CapacitorFreerasp.podspec +5 -1
- package/README.md +8 -8
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/aheaditec/freerasp/FreeraspPlugin.kt +106 -33
- package/android/src/main/java/com/aheaditec/freerasp/PluginThreatHandler.kt +121 -0
- package/android/src/main/java/com/aheaditec/freerasp/ScreenProtector.kt +24 -2
- package/android/src/main/java/com/aheaditec/freerasp/dispatchers/ExecutionStateDispatcher.kt +38 -0
- package/android/src/main/java/com/aheaditec/freerasp/dispatchers/ThreatDispatcher.kt +62 -0
- package/android/src/main/java/com/aheaditec/freerasp/events/BaseRaspEvent.kt +7 -0
- package/android/src/main/java/com/aheaditec/freerasp/events/RaspExecutionStateEvent.kt +22 -0
- package/android/src/main/java/com/aheaditec/freerasp/events/ThreatEvent.kt +71 -0
- package/android/src/main/java/com/aheaditec/freerasp/interfaces/PluginExecutionStateListener.kt +7 -0
- package/android/src/main/java/com/aheaditec/freerasp/interfaces/PluginThreatListener.kt +9 -0
- package/android/src/main/java/com/aheaditec/freerasp/models/CapSuspiciousAppInfo.kt +1 -0
- package/android/src/main/java/com/aheaditec/freerasp/utils/Extensions.kt +1 -0
- package/android/src/main/java/com/aheaditec/freerasp/utils/RandomGenerator.kt +24 -0
- package/android/src/main/java/com/aheaditec/freerasp/utils/Utils.kt +3 -5
- package/dist/esm/api/listeners/raspExecutionState.d.ts +3 -0
- package/dist/esm/api/listeners/raspExecutionState.js +40 -0
- package/dist/esm/api/listeners/raspExecutionState.js.map +1 -0
- package/dist/esm/api/listeners/threat.d.ts +3 -0
- package/dist/esm/api/listeners/threat.js +104 -0
- package/dist/esm/api/listeners/threat.js.map +1 -0
- package/dist/esm/api/methods/capacitor.d.ts +4 -0
- package/dist/esm/api/methods/capacitor.js +11 -0
- package/dist/esm/api/methods/capacitor.js.map +1 -0
- package/dist/esm/api/methods/native.d.ts +7 -0
- package/dist/esm/api/methods/native.js +36 -0
- package/dist/esm/api/methods/native.js.map +1 -0
- package/dist/esm/api/nativeModules.d.ts +2 -0
- package/dist/esm/api/nativeModules.js +3 -0
- package/dist/esm/api/nativeModules.js.map +1 -0
- package/dist/esm/channels/raspExecutionState.d.ts +3 -0
- package/dist/esm/channels/raspExecutionState.js +27 -0
- package/dist/esm/channels/raspExecutionState.js.map +1 -0
- package/dist/esm/channels/threat.d.ts +3 -0
- package/dist/esm/channels/threat.js +34 -0
- package/dist/esm/channels/threat.js.map +1 -0
- package/dist/esm/index.d.ts +7 -12
- package/dist/esm/index.js +7 -158
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/raspExecutionState.d.ts +6 -0
- package/dist/esm/models/raspExecutionState.js +10 -0
- package/dist/esm/models/raspExecutionState.js.map +1 -0
- package/dist/esm/models/threat.d.ts +27 -0
- package/dist/esm/{definitions.js → models/threat.js} +9 -3
- package/dist/esm/models/threat.js.map +1 -0
- package/dist/esm/{definitions.d.ts → types/types.d.ts} +41 -44
- package/dist/esm/types/types.js +2 -0
- package/dist/esm/types/types.js.map +1 -0
- package/dist/esm/utils/malware.d.ts +3 -0
- package/dist/esm/utils/malware.js +22 -0
- package/dist/esm/utils/malware.js.map +1 -0
- package/dist/esm/utils/utils.d.ts +3 -0
- package/dist/esm/utils/utils.js +12 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/plugin.cjs.js +197 -76
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +197 -76
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/FreeraspPlugin.m +3 -0
- package/ios/Plugin/FreeraspPlugin.swift +36 -77
- package/ios/Plugin/Info.plist +1 -1
- package/ios/Plugin/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/_CodeSignature/CodeResources +100 -298
- package/ios/Plugin/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +7 -2
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +380 -281
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curlver.h +5 -6
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/easy.h +4 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/header.h +1 -1
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/mprintf.h +11 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +62 -22
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +2 -2
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/system.h +76 -164
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +5 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/websockets.h +17 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +233 -528
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +14 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +380 -281
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curlver.h +5 -6
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/easy.h +4 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/header.h +1 -1
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/mprintf.h +11 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +62 -22
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +2 -2
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/system.h +76 -164
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/typecheck-gcc.h +947 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +5 -4
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/websockets.h +17 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +233 -528
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +233 -528
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +7 -3
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/Plugin/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +56 -45
- package/ios/Plugin/dispatchers/ExecutionStateDispatcher.swift +35 -0
- package/ios/Plugin/dispatchers/ThreatDispatcher.swift +36 -0
- package/ios/Plugin/models/RaspExecutionStates.swift +15 -0
- package/ios/Plugin/models/SecurityThreat.swift +40 -0
- package/ios/Plugin/utils/EventIdentifiers.swift +17 -0
- package/ios/Plugin/utils/RandomGenerator.swift +23 -0
- package/ios/Plugin/utils/Utils.swift +32 -0
- package/package.json +15 -10
- package/android/src/main/java/com/aheaditec/freerasp/Threat.kt +0 -58
- package/android/src/main/java/com/aheaditec/freerasp/ThreatHandler.kt +0 -76
- package/dist/esm/definitions.js.map +0 -1
- package/dist/esm/utils.d.ts +0 -2
- package/dist/esm/utils.js +0 -8
- package/dist/esm/utils.js.map +0 -1
- package/ios/Plugin/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
|
@@ -7,11 +7,16 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
7
7
|
|
|
8
8
|
public static var shared: FreeraspPlugin?
|
|
9
9
|
|
|
10
|
-
let threatChannelKey = String(Int.random(in: 100_000..<999_999_999)) // key of the argument map under which threats are expected
|
|
11
|
-
let threatChannelName = String(Int.random(in: 100_000..<999_999_999)) // name of the channel over which threat callbacks are sent
|
|
12
|
-
|
|
13
10
|
override public func load() {
|
|
14
11
|
FreeraspPlugin.shared = self
|
|
12
|
+
|
|
13
|
+
ThreatDispatcher.shared.listener = { [weak self] threat in
|
|
14
|
+
self?.notifyListeners(EventIdentifiers.threatChannelName, data: [EventIdentifiers.threatChannelKey: threat.callbackIdentifier], retainUntilConsumed: true)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ExecutionStateDispatcher.shared.listener = { [weak self] event in
|
|
18
|
+
self?.notifyListeners(EventIdentifiers.raspExecutionStateChannelName, data: [EventIdentifiers.raspExecutionStateChannelKey: event.callbackIdentifier], retainUntilConsumed: true)
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
/// Runs Talsec with given configuration
|
|
@@ -40,6 +45,11 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
40
45
|
UserDefaults.standard.set(externalId, forKey: "app.talsec.externalid")
|
|
41
46
|
call.resolve(["result": true])
|
|
42
47
|
}
|
|
48
|
+
|
|
49
|
+
@objc func removeExternalId(_ call: CAPPluginCall) -> Void {
|
|
50
|
+
UserDefaults.standard.removeObject(forKey: "app.talsec.externalid")
|
|
51
|
+
call.resolve(["result": true])
|
|
52
|
+
}
|
|
43
53
|
|
|
44
54
|
@objc func blockScreenCapture(_ call: CAPPluginCall) -> Void {
|
|
45
55
|
guard let enable = call.getBool("enable") else {
|
|
@@ -68,28 +78,21 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
private func getProtectedWindow(completion: @escaping (UIWindow?) -> Void) {
|
|
72
|
-
DispatchQueue.main.async {
|
|
73
|
-
if #available(iOS 13.0, *) {
|
|
74
|
-
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
|
|
75
|
-
if let window = windowScene.windows.first {
|
|
76
|
-
completion(window)
|
|
77
|
-
} else {
|
|
78
|
-
completion(nil)
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
completion(nil)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
81
|
/**
|
|
88
|
-
* Method to setup the message passing between native and
|
|
82
|
+
* Method to setup the message passing between native and Capacitor
|
|
89
83
|
*/
|
|
90
84
|
@objc func getThreatChannelData(_ call: CAPPluginCall) -> Void {
|
|
91
85
|
call.resolve([
|
|
92
|
-
"ids": [threatChannelName, threatChannelKey]
|
|
86
|
+
"ids": [EventIdentifiers.threatChannelName, EventIdentifiers.threatChannelKey]
|
|
87
|
+
])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Method to setup the message passing between native and Capacitor
|
|
92
|
+
*/
|
|
93
|
+
@objc func getRaspExecutionStateChannelData(_ call: CAPPluginCall) -> Void {
|
|
94
|
+
call.resolve([
|
|
95
|
+
"ids": [EventIdentifiers.raspExecutionStateChannelName, EventIdentifiers.raspExecutionStateChannelKey]
|
|
93
96
|
])
|
|
94
97
|
}
|
|
95
98
|
|
|
@@ -98,9 +101,15 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
98
101
|
*/
|
|
99
102
|
@objc func getThreatIdentifiers(_ call: CAPPluginCall) -> Void {
|
|
100
103
|
call.resolve([
|
|
101
|
-
"ids":
|
|
104
|
+
"ids": getThreatIdentifiersList()
|
|
102
105
|
])
|
|
103
106
|
}
|
|
107
|
+
|
|
108
|
+
@objc func getRaspExecutionStateIdentifiers(_ call: CAPPluginCall) -> Void {
|
|
109
|
+
call.resolve([
|
|
110
|
+
"ids": getRaspExecutionStateIdentifiersList()
|
|
111
|
+
])
|
|
112
|
+
}
|
|
104
113
|
|
|
105
114
|
/**
|
|
106
115
|
* We never send an invalid callback over our channel.
|
|
@@ -110,16 +119,6 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
110
119
|
abort()
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
private func getThreatIdentifiers() -> [Int] {
|
|
114
|
-
return SecurityThreat.allCases
|
|
115
|
-
.filter {
|
|
116
|
-
threat in threat.rawValue != "passcodeChange"
|
|
117
|
-
}
|
|
118
|
-
.map {
|
|
119
|
-
threat in threat.callbackIdentifier
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
122
|
private func initializeTalsec(talsecConfig: JSObject) throws {
|
|
124
123
|
guard let iosConfig = talsecConfig["iosConfig"] as? JSObject else {
|
|
125
124
|
throw NSError(domain: "Missing iosConfig parameter in Talsec Native Plugin", code: 1)
|
|
@@ -140,56 +139,16 @@ public class FreeraspPlugin: CAPPlugin {
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
extension SecurityThreatCenter: SecurityThreatHandler {
|
|
142
|
+
extension SecurityThreatCenter: @retroactive SecurityThreatHandler, @retroactive RaspExecutionState {
|
|
144
143
|
|
|
145
144
|
public func threatDetected(_ securityThreat: TalsecRuntime.SecurityThreat) {
|
|
146
145
|
if (securityThreat.rawValue == "passcodeChange") {
|
|
147
146
|
return
|
|
148
147
|
}
|
|
149
|
-
|
|
150
|
-
FreeraspPlugin.shared!.notifyListeners(FreeraspPlugin.shared!.threatChannelName, data: [FreeraspPlugin.shared!.threatChannelKey: securityThreat.callbackIdentifier], retainUntilConsumed: true)
|
|
148
|
+
ThreatDispatcher.shared.dispatch(threat: securityThreat)
|
|
151
149
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
static let threatIdentifierList: [Int] = (1...14).map { _ in Int.random(in: 100_000..<999_999_999) }
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/// An extension to unify callback names with Capacitor ones.
|
|
159
|
-
extension SecurityThreat {
|
|
160
|
-
|
|
161
|
-
var callbackIdentifier: Int {
|
|
162
|
-
switch self {
|
|
163
|
-
case .signature:
|
|
164
|
-
return ThreatIdentifiers.threatIdentifierList[0]
|
|
165
|
-
case .jailbreak:
|
|
166
|
-
return ThreatIdentifiers.threatIdentifierList[1]
|
|
167
|
-
case .debugger:
|
|
168
|
-
return ThreatIdentifiers.threatIdentifierList[2]
|
|
169
|
-
case .runtimeManipulation:
|
|
170
|
-
return ThreatIdentifiers.threatIdentifierList[3]
|
|
171
|
-
case .passcode:
|
|
172
|
-
return ThreatIdentifiers.threatIdentifierList[4]
|
|
173
|
-
case .passcodeChange:
|
|
174
|
-
return ThreatIdentifiers.threatIdentifierList[5]
|
|
175
|
-
case .simulator:
|
|
176
|
-
return ThreatIdentifiers.threatIdentifierList[6]
|
|
177
|
-
case .missingSecureEnclave:
|
|
178
|
-
return ThreatIdentifiers.threatIdentifierList[7]
|
|
179
|
-
case .systemVPN:
|
|
180
|
-
return ThreatIdentifiers.threatIdentifierList[8]
|
|
181
|
-
case .deviceChange:
|
|
182
|
-
return ThreatIdentifiers.threatIdentifierList[9]
|
|
183
|
-
case .deviceID:
|
|
184
|
-
return ThreatIdentifiers.threatIdentifierList[10]
|
|
185
|
-
case .unofficialStore:
|
|
186
|
-
return ThreatIdentifiers.threatIdentifierList[11]
|
|
187
|
-
case .screenshot:
|
|
188
|
-
return ThreatIdentifiers.threatIdentifierList[12]
|
|
189
|
-
case .screenRecording:
|
|
190
|
-
return ThreatIdentifiers.threatIdentifierList[13]
|
|
191
|
-
@unknown default:
|
|
192
|
-
abort()
|
|
193
|
-
}
|
|
150
|
+
|
|
151
|
+
public func onAllChecksFinished() {
|
|
152
|
+
ExecutionStateDispatcher.shared.dispatch(event: RaspExecutionStates.allChecksFinished)
|
|
194
153
|
}
|
|
195
154
|
}
|
package/ios/Plugin/Info.plist
CHANGED
|
Binary file
|