freerasp-react-native 3.8.2 → 3.9.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/README.md +9 -3
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +19 -42
  5. package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +3 -0
  6. package/android/src/main/java/com/freeraspreactnative/Utils.kt +40 -0
  7. package/android/src/main/java/com/freeraspreactnative/exceptions/TalsecException.kt +3 -0
  8. package/example/src/App.tsx +1 -1
  9. package/ios/FreeraspReactNative.swift +1 -1
  10. package/ios/TalsecRuntime.xcframework/Info.plist +9 -5
  11. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeDirectory +0 -0
  12. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  13. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeResources +105 -105
  14. package/ios/TalsecRuntime.xcframework/_CodeSignature/CodeSignature +0 -0
  15. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  16. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +22 -5
  17. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curl.h +57 -43
  18. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/curlver.h +4 -4
  19. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/mprintf.h +13 -5
  20. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/multi.h +18 -4
  21. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/options.h +1 -1
  22. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/system.h +1 -11
  23. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/urlapi.h +5 -1
  24. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
  25. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +217 -2211
  26. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -3
  27. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  28. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +3 -3
  29. package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
  30. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
  31. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +44 -10
  32. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curl.h +57 -43
  33. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/curlver.h +4 -4
  34. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/mprintf.h +13 -5
  35. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/multi.h +18 -4
  36. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/options.h +1 -1
  37. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/system.h +1 -11
  38. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/urlapi.h +5 -1
  39. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
  40. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +220 -2193
  41. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -3
  42. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  43. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -3
  44. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +220 -2193
  45. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -3
  46. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  47. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -3
  48. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
  49. package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +39 -39
  50. package/lib/commonjs/index.js +8 -4
  51. package/lib/commonjs/index.js.map +1 -1
  52. package/lib/module/index.js +8 -4
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/typescript/src/index.d.ts.map +1 -1
  55. package/package.json +2 -2
  56. package/src/index.tsx +8 -4
package/CHANGELOG.md CHANGED
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.9.0] - 2024-09-25
9
+
10
+ - Android SDK version: 11.1.0
11
+ - iOS SDK version: 6.6.0
12
+
13
+ ### React Native
14
+
15
+ #### Fixed
16
+
17
+ - Fixed incorrect path to types in package.json
18
+
19
+ #### Changed
20
+
21
+ - Improved error messages when validation of the freeRASP configuration fails
22
+
23
+ ### Android
24
+
25
+ #### Added
26
+
27
+ - Added the auditing of the internal execution for the future check optimization and overall security improvements.
28
+
29
+ #### Fixed
30
+
31
+ - Fixed native crashes (SEGFAULT errors) in `ifpip` method
32
+ - Fixed collision for command line tools (like ping) invoked without absolute path
33
+
34
+ #### Changed
35
+
36
+ - ❗️Breaking: Changed the way TalsecConfig is created, we introduced a Builder pattern to make the process more streamlined and readable
37
+ - Updated OpenSSL to version 3.0.14
38
+ - Updated CURL to version 8.8.0
39
+ - Refactored fetching the list of installed applications for root and hook detection.
40
+
41
+ ### iOS
42
+
43
+ #### Added
44
+
45
+ - [Dopamine](https://github.com/opa334/Dopamine) jailbreak detection.
46
+
47
+ #### Changed
48
+
49
+ - Updated OpenSSL to version 3.0.14
50
+ - Updated CURL to version 8.8.0
51
+
8
52
  ## [3.8.2] - 2024-09-02
9
53
 
10
54
  ### React Native
@@ -29,13 +73,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
29
73
  ### Android
30
74
 
31
75
  - ⚡ Added new threat `devMode` for Developer mode detection
32
- - ⚡ Enhanced and accelerated the data collection logic
33
76
  - ⚡ Fixed proguard warning in specific versions of RN
34
77
  - ⚡ Fixed issue with Arabic alphabet in logs caused by the device’s default system locale
35
78
  - ✔️ Increased the version of the GMS dependency
36
79
  - ✔️ Updated CA bundle
37
80
 
38
81
  ### iOS
82
+ - ⚡ Enhanced and accelerated the data collection logic
39
83
  - ⚡ Fixed issue with Arabic alphabet in logs caused by the device’s default system locale
40
84
  - ⚡ Passcode check is now periodical
41
85
  - ✔️ Updated CA bundle
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  freeRASP for React Native is a mobile in-app protection and security monitoring plugin. It aims to cover the main aspects of RASP (Runtime App Self Protection) and application shielding.
10
10
 
11
- :loudspeaker: The official documentation has been moved to a new location. You can now find it [here](https://docs.talsec.app/freerasp). :loudspeaker:
11
+ :loudspeaker: The official documentation has been moved to a new location. You can now find it [here](https://docs.talsec.app/docs-and-articles-portal). :loudspeaker:
12
12
 
13
13
 
14
14
  # Overview
@@ -46,10 +46,12 @@ Learn more about commercial features at [https://talsec.app](https://talsec.app)
46
46
 
47
47
  Learn more about freemium freeRASP features at [GitHub main repository](https://github.com/talsec/Free-RASP-Community).
48
48
 
49
- # :book: Discover Official Documentation
50
- Visit the [GitBook page](https://docs.talsec.app/freerasp) for comprehensive and up-to-date guides, tutorials, and technical documentation. It serves as your go-to resource, offering everything from basic instructions to advanced tips and tricks to help you get the most out of the project.
49
+ # :book: Discover the Official freeRASP Documentation
50
+
51
+ Visit the [GitBook page](https://docs.talsec.app/freerasp) for comprehensive and up-to-date guides, tutorials, and technical documentation specifically for freeRASP. It serves as your go-to resource, offering everything from basic instructions to advanced tips and tricks to help you get the most out of the project.
51
52
 
52
53
  ## :link: Integration Guide
54
+
53
55
  For integrating freeRASP on the React Native platform, be sure to follow all the steps in the [Integration Guide](https://docs.talsec.app/freerasp/integration). This guide provides detailed instructions to help you achieve a smooth and efficient integration.
54
56
 
55
57
  Be sure to bookmark it and stay informed! :books: :sparkles:.
@@ -61,6 +63,7 @@ If you have any suggestions for improvement or notice anything that could be cla
61
63
  For information on older integration methods, you can refer to the [freeRASP wiki](https://github.com/talsec/Free-RASP-ReactNative/wiki), which includes comprehensive legacy details and guidance. Additionally, the old integration can be found when you checkout to a specific tag. Your input is invaluable in helping us improve our resources and provide even better support for your needs.
62
64
 
63
65
  # :rocket: What's New and Changelog
66
+
64
67
  Stay informed and make the most of freeRASP by checking out [What's New and Changelog](https://docs.talsec.app/freerasp/whats-new-and-changelog)! Here, you’ll discover the latest features, enhancements, and bug fixes we’ve implemented to improve your experience across all platforms, including Android, iOS, Flutter, React Native, Capacitor, and Cordova.
65
68
 
66
69
  Don’t miss out on any updates and explore the changelog to see how we’re continually making freeRASP better for you!
@@ -70,3 +73,6 @@ Don’t miss out on any updates and explore the changelog to see how we’re con
70
73
  If you have any ideas for improvements, feel free to [raise an issue](https://github.com/talsec/Free-RASP-ReactNative/issues) and mark it with an **enhancement** label. We track these enhancements using [GitHub Projects](https://docs.github.com/en/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects) to keep tasks organized and connected to relevant issues or pull requests.
71
74
 
72
75
  You can check out the project board [here](https://github.com/orgs/talsec/projects/2).
76
+
77
+ # :page_facing_up: License
78
+ This project is provided as freemium software, i.e. there is a fair usage policy that imposes some limitations on the free usage. The SDK software consists of open-source and binary parts, which is the property of Talsec. The open-source part is licensed under the MIT License - see the LICENSE file for details.
@@ -87,7 +87,7 @@ dependencies {
87
87
  //noinspection GradleDynamicVersion
88
88
  implementation "com.facebook.react:react-native:$react_native_version"
89
89
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
90
- implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:9.6.0"
90
+ implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:11.1.0"
91
91
  }
92
92
 
93
93
  if (isNewArchitectureEnabled()) {
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.ReactApplicationContext
9
9
  import com.facebook.react.bridge.ReactContextBaseJavaModule
10
10
  import com.facebook.react.bridge.ReactMethod
11
11
  import com.facebook.react.bridge.ReadableMap
12
+ import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
12
13
  import com.facebook.react.bridge.WritableArray
13
14
  import com.facebook.react.modules.core.DeviceEventManagerModule
14
15
 
@@ -32,17 +33,18 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
32
33
  ) {
33
34
 
34
35
  try {
35
- val config = parseTalsecConfig(options)
36
+ val config = buildTalsecConfig(options)
36
37
  FreeraspThreatHandler.listener = ThreatListener
37
38
  listener.registerListener(reactContext)
38
- Talsec.start(reactContext, config)
39
+ runOnUiThread {
40
+ Talsec.start(reactContext, config)
41
+ }
42
+
39
43
  promise.resolve("freeRASP started")
40
44
 
41
- } catch (e: Exception) {
42
- val params = Arguments.createMap().apply {
43
- putString("message", e.message)
44
- }
45
- promise.reject("initializationError", params)
45
+ }
46
+ catch (e: Exception) {
47
+ promise.reject("TalsecInitializationError", e.message, e)
46
48
  }
47
49
  }
48
50
 
@@ -85,42 +87,17 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
85
87
  // Remove upstream listeners, stop unnecessary background tasks
86
88
  }
87
89
 
88
- private fun parseTalsecConfig(config: ReadableMap): TalsecConfig {
89
- val androidConfig = config.getMap("androidConfig")!!
90
- val packageName = androidConfig.getString("packageName")!!
91
- val certificateHashes = mutableListOf<String>()
92
- val hashes = androidConfig.getArray("certificateHashes")!!
93
- for (i in 0 until hashes.size()) {
94
- // in RN versions < 0.63, getString is nullable
95
- @Suppress("UNNECESSARY_SAFE_CALL")
96
- hashes.getString(i)?.let {
97
- certificateHashes.add(it)
98
- }
99
- }
100
- val watcherMail = config.getString("watcherMail")
101
- val alternativeStores = mutableListOf<String>()
102
- if (androidConfig.hasKey("supportedAlternativeStores")) {
103
- val stores = androidConfig.getArray("supportedAlternativeStores")!!
104
- for (i in 0 until stores.size()) {
105
- // in RN versions < 0.63, getString is nullable
106
- @Suppress("UNNECESSARY_SAFE_CALL")
107
- stores.getString(i)?.let {
108
- alternativeStores.add(it)
109
- }
110
- }
111
- }
112
- var isProd = true
113
- if (config.hasKey("isProd")) {
114
- isProd = config.getBoolean("isProd")
115
- }
90
+ private fun buildTalsecConfig(config: ReadableMap): TalsecConfig {
91
+ val androidConfig = config.getMapThrowing("androidConfig")
92
+ val packageName = androidConfig.getStringThrowing("packageName")
93
+ val certificateHashes = androidConfig.getArraySafe("certificateHashes")
94
+
95
+ val talsecBuilder = TalsecConfig.Builder(packageName, certificateHashes)
96
+ .watcherMail(config.getString("watcherMail"))
97
+ .supportedAlternativeStores(androidConfig.getArraySafe("supportedAlternativeStores"))
98
+ .prod(config.getBooleanSafe("isProd"))
116
99
 
117
- return TalsecConfig(
118
- packageName,
119
- certificateHashes.toTypedArray(),
120
- watcherMail,
121
- alternativeStores.toTypedArray(),
122
- isProd
123
- )
100
+ return talsecBuilder.build()
124
101
  }
125
102
 
126
103
  companion object {
@@ -1,5 +1,6 @@
1
1
  package com.freeraspreactnative
2
2
 
3
+ import com.aheaditec.talsec_security.security.api.SuspiciousAppInfo
3
4
  import com.aheaditec.talsec_security.security.api.ThreatListener
4
5
 
5
6
  internal object FreeraspThreatHandler : ThreatListener.ThreatDetected, ThreatListener.DeviceState {
@@ -38,6 +39,8 @@ internal object FreeraspThreatHandler : ThreatListener.ThreatDetected, ThreatLis
38
39
  listener?.threatDetected(Threat.ObfuscationIssues)
39
40
  }
40
41
 
42
+ override fun onMalwareDetected(p0: MutableList<SuspiciousAppInfo>?) {}
43
+
41
44
  override fun onUnlockedDeviceDetected() {
42
45
  listener?.threatDetected(Threat.Passcode)
43
46
  }
@@ -0,0 +1,40 @@
1
+ package com.freeraspreactnative
2
+
3
+ import com.facebook.react.bridge.ReadableArray
4
+ import com.facebook.react.bridge.ReadableMap
5
+ import com.freeraspreactnative.exceptions.TalsecException
6
+
7
+ internal fun ReadableMap.getMapThrowing(key: String): ReadableMap {
8
+ return this.getMap(key) ?: throw TalsecException("Key missing in configuration: $key")
9
+ }
10
+
11
+ internal fun ReadableMap.getStringThrowing(key: String): String {
12
+ return this.getString(key) ?: throw TalsecException("Key missing in configuration: $key")
13
+ }
14
+
15
+ internal fun ReadableMap.getBooleanSafe(key: String, defaultValue: Boolean = true): Boolean {
16
+ if (this.hasKey(key)) {
17
+ return this.getBoolean(key)
18
+ }
19
+ return defaultValue
20
+ }
21
+
22
+ internal fun ReadableArray.toArray(): Array<String> {
23
+ val output = mutableListOf<String>()
24
+ for (i in 0 until this.size()) {
25
+ // in RN versions < 0.63, getString is nullable
26
+ @Suppress("UNNECESSARY_SAFE_CALL")
27
+ this.getString(i)?.let {
28
+ output.add(it)
29
+ }
30
+ }
31
+ return output.toTypedArray()
32
+ }
33
+
34
+ internal fun ReadableMap.getArraySafe(key: String): Array<String> {
35
+ if (this.hasKey(key)) {
36
+ val inputArray = this.getArray(key)!!
37
+ return inputArray.toArray()
38
+ }
39
+ return arrayOf()
40
+ }
@@ -0,0 +1,3 @@
1
+ package com.freeraspreactnative.exceptions
2
+
3
+ class TalsecException(message: String, val code: String? = null, val ex: Exception? = null) : Exception(message)
@@ -14,7 +14,7 @@ const App = () => {
14
14
  const config = {
15
15
  androidConfig: {
16
16
  packageName: 'com.freeraspreactnativeexample',
17
- certificateHashes: ['your_signing_certificate_hash_base64'],
17
+ certificateHashes: ['AKoRuyLMM91E7lX/Zqp3u4jMmd0A7hH/Iqozu0TMVd0='],
18
18
  // supportedAlternativeStores: ['storeOne', 'storeTwo'],
19
19
  },
20
20
  iosConfig: {
@@ -20,7 +20,7 @@ class FreeraspReactNative: RCTEventEmitter {
20
20
  try initializeTalsec(talsecConfig: options)
21
21
  }
22
22
  catch let error as NSError {
23
- reject("initialization_error", "Could not initialize freeRASP", error)
23
+ reject("TalsecInitializationError", "Could not initialize freeRASP: \(error.domain)", error)
24
24
  return
25
25
  }
26
26
  resolve("freeRASP started")
@@ -5,31 +5,35 @@
5
5
  <key>AvailableLibraries</key>
6
6
  <array>
7
7
  <dict>
8
+ <key>BinaryPath</key>
9
+ <string>TalsecRuntime.framework/TalsecRuntime</string>
8
10
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
10
12
  <key>LibraryPath</key>
11
13
  <string>TalsecRuntime.framework</string>
12
14
  <key>SupportedArchitectures</key>
13
15
  <array>
14
16
  <string>arm64</string>
17
+ <string>x86_64</string>
15
18
  </array>
16
19
  <key>SupportedPlatform</key>
17
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
18
23
  </dict>
19
24
  <dict>
25
+ <key>BinaryPath</key>
26
+ <string>TalsecRuntime.framework/TalsecRuntime</string>
20
27
  <key>LibraryIdentifier</key>
21
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
22
29
  <key>LibraryPath</key>
23
30
  <string>TalsecRuntime.framework</string>
24
31
  <key>SupportedArchitectures</key>
25
32
  <array>
26
33
  <string>arm64</string>
27
- <string>x86_64</string>
28
34
  </array>
29
35
  <key>SupportedPlatform</key>
30
36
  <string>ios</string>
31
- <key>SupportedPlatformVariant</key>
32
- <string>simulator</string>
33
37
  </dict>
34
38
  </array>
35
39
  <key>CFBundlePackageType</key>