Skip to content

Commit d0761d8

Browse files
martinzigraitompsotacursoragent
authored
release: freeRASP 5.1.0 (#155)
* feat: add opt-in SPM integration for TalsecRuntime on iOS * ci: add non-blocking iOS SPM smoke-test job * feat: add TalsecRuntime SPM embed helper and placeholder wiring * feat: scaffold opt-in Expo iOS SPM support * feat: make SPM the sole iOS delivery for TalsecRuntime (stage 2 prep) * feat: enable Expo iOS SPM support by default * ci: build iOS example via SPM only * refactor: default to SPM with vendored fallback (react-native-firebase pattern) * fix: guard Expo iOS SPM embed on SPM-active condition * ci: add vendored fallback gate alongside non-blocking SPM build * feat: point iOS SPM at Free-RASP-ReactNative-SPM manifest repo (exact 6.14.4) * fix: make SPM embed helper idempotent to avoid duplicate framework embed * fix: resolve Expo plugin eslint errors (no-shadow, avoid namespace imports) * feat: keep package.swift in the project * fix: harden iOS SPM integration Co-authored-by: Cursor <cursoragent@cursor.com> * fix: ci + changelog * refactor: consolidate iOS SPM environment flag Co-authored-by: Cursor <cursoragent@cursor.com> * docs: streamline SPM integration guidance Co-authored-by: Cursor <cursoragent@cursor.com> * release: freeRASP 5.1.0 * fix(android): return reusable event identifiers Co-authored-by: Cursor <cursoragent@cursor.com> * fix: changelog * feat: raise ios sdk version * fix: changelog --------- Co-authored-by: Tomas Psota <to.psota@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b525312 commit d0761d8

50 files changed

Lines changed: 1886 additions & 888 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
run: |
2929
yarn expo:typecheck
3030
31+
- name: Test Expo plugin
32+
run: yarn test:plugin
33+
3134
- name: Format check
3235
run: yarn prettier --check
3336

@@ -84,6 +87,8 @@ jobs:
8487
build-ios:
8588
runs-on: macos-latest
8689
needs: build-library
90+
env:
91+
FREERASP_USE_SPM: "0"
8792
steps:
8893
- name: Checkout
8994
uses: actions/checkout@v6
@@ -99,3 +104,25 @@ jobs:
99104
working-directory: ./example
100105
run: |
101106
yarn build:ios
107+
108+
build-ios-spm:
109+
runs-on: macos-latest
110+
needs: build-library
111+
env:
112+
USE_FRAMEWORKS: dynamic
113+
FREERASP_USE_SPM: "1"
114+
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v6
117+
118+
- name: Setup
119+
uses: ./.github/actions/setup
120+
121+
- name: Install pods (SPM)
122+
working-directory: ./example/ios
123+
run: pod install
124+
125+
- name: Build example for iOS (SPM)
126+
working-directory: ./example
127+
run: |
128+
yarn build:ios

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ xcuserdata
2424
*.xccheckout
2525
*.moved-aside
2626
DerivedData
27+
.build/
2728
*.hmap
2829
*.ipa
2930
*.xcuserstate

‎CHANGELOG.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.1.0]
9+
10+
- Android SDK version: 18.3.0
11+
- iOS SDK version: 7.1.0
12+
13+
### React Native
14+
15+
#### Fixed
16+
17+
- Fixed identifier retrieval after React Native context reinitialization ([#152](https://github.com/talsec/Free-RASP-ReactNative/issues/152)).
18+
19+
#### Added
20+
21+
- Added Swift Package Manager delivery of `TalsecRuntime`, enabled by default for Expo projects and available as an opt-in for bare React Native 0.75 or newer projects.
22+
- Added the Expo config plugin option `ios.useSpm`; set it to `false` to use the vendored XCFramework fallback.
23+
24+
### iOS
25+
26+
#### Added
27+
28+
- Added support for postponed checks, therefore, due to slower execution, some subchecks are run after initial startup checks.
29+
- Improved hook detection.
30+
31+
#### Fixed
32+
33+
- Fixed issue with app's color scheme initialization.
34+
- Fixed bad memory access in jaibreak check.
35+
836
## [5.0.0] - 2026-05-15
937

1038
- Android SDK version: 18.3.0

‎android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,28 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex
108108

109109
// Trigger lazy initialization of the freeRASP events
110110
private fun initializeEventKeys() {
111-
ThreatEvent.ALL_EVENTS
112-
RaspExecutionStateEvent.ALL_EVENTS
111+
ThreatEvent.ALL_EVENT_IDENTIFIERS
112+
RaspExecutionStateEvent.ALL_EVENT_IDENTIFIERS
113113
}
114114

115115
/**
116116
* Method to get the random identifiers of callbacks
117117
*/
118118
@ReactMethod
119119
fun getThreatIdentifiers(promise: Promise) {
120-
promise.resolve(ThreatEvent.ALL_EVENTS)
120+
promise.resolve(
121+
Arguments.fromList(ThreatEvent.ALL_EVENT_IDENTIFIERS)
122+
)
121123
}
122124

123125
/**
124126
* Method to get the random identifiers of callbacks
125127
*/
126128
@ReactMethod
127129
fun getRaspExecutionStateIdentifiers(promise: Promise) {
128-
promise.resolve(RaspExecutionStateEvent.ALL_EVENTS)
130+
promise.resolve(
131+
Arguments.fromList(RaspExecutionStateEvent.ALL_EVENT_IDENTIFIERS)
132+
)
129133
}
130134

131135
/**
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.freeraspreactnative.events
22

3-
import com.facebook.react.bridge.Arguments
43
import com.freeraspreactnative.utils.RandomGenerator
54

65
internal sealed class RaspExecutionStateEvent(override val value: Int) : BaseRaspEvent {
@@ -12,9 +11,8 @@ internal sealed class RaspExecutionStateEvent(override val value: Int) : BaseRas
1211
companion object Companion {
1312
internal val CHANNEL_NAME = RandomGenerator.next().toString()
1413
internal val CHANNEL_KEY = RandomGenerator.next().toString()
15-
internal val ALL_EVENTS = Arguments.fromList(
16-
listOf(
17-
AllChecksFinished
18-
).map { it.value })
14+
internal val ALL_EVENT_IDENTIFIERS = listOf(
15+
AllChecksFinished
16+
).map { it.value }
1917
}
2018
}

‎android/src/main/java/com/freeraspreactnative/events/ThreatEvent.kt‎

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.freeraspreactnative.events
22

3-
import com.facebook.react.bridge.Arguments
43
import com.freeraspreactnative.utils.RandomGenerator
54

65
/**
@@ -41,29 +40,28 @@ internal sealed class ThreatEvent(override val value: Int) : BaseRaspEvent {
4140
internal val CHANNEL_KEY = RandomGenerator.next().toString()
4241
internal val MALWARE_CHANNEL_KEY = RandomGenerator.next().toString()
4342

44-
internal val ALL_EVENTS = Arguments.fromList(
45-
listOf(
46-
AppIntegrity,
47-
PrivilegedAccess,
48-
Debug,
49-
Hooks,
50-
Passcode,
51-
Simulator,
52-
SecureHardwareNotAvailable,
53-
SystemVPN,
54-
DeviceBinding,
55-
UnofficialStore,
56-
ObfuscationIssues,
57-
DevMode,
58-
Malware,
59-
ADBEnabled,
60-
Screenshot,
61-
ScreenRecording,
62-
MultiInstance,
63-
TimeSpoofing,
64-
LocationSpoofing,
65-
UnsecureWifi,
66-
Automation
67-
).map { it.value })
43+
internal val ALL_EVENT_IDENTIFIERS = listOf(
44+
AppIntegrity,
45+
PrivilegedAccess,
46+
Debug,
47+
Hooks,
48+
Passcode,
49+
Simulator,
50+
SecureHardwareNotAvailable,
51+
SystemVPN,
52+
DeviceBinding,
53+
UnofficialStore,
54+
ObfuscationIssues,
55+
DevMode,
56+
Malware,
57+
ADBEnabled,
58+
Screenshot,
59+
ScreenRecording,
60+
MultiInstance,
61+
TimeSpoofing,
62+
LocationSpoofing,
63+
UnsecureWifi,
64+
Automation
65+
).map { it.value }
6866
}
6967
}

‎example/ios/Podfile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ require Pod::Executable.execute_command('node', ['-p',
88
platform :ios, min_ios_version_supported
99
prepare_react_native_project!
1010

11+
# SPM CI sets FREERASP_USE_SPM=1 and requires dynamic frameworks.
12+
use_freerasp_spm = ENV['FREERASP_USE_SPM'] == '1'
1113
linkage = ENV['USE_FRAMEWORKS']
14+
if use_freerasp_spm
15+
if linkage != nil && linkage != 'dynamic'
16+
raise Pod::Informative, 'freeRASP SPM requires USE_FRAMEWORKS=dynamic'
17+
end
18+
linkage = 'dynamic'
19+
end
1220
if linkage != nil
1321
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
1422
use_frameworks! :linkage => linkage.to_sym
@@ -31,5 +39,20 @@ target 'FreeraspRNExample' do
3139
:mac_catalyst_enabled => false,
3240
# :ccache_enabled => true
3341
)
42+
43+
# React Native 0.78 pins fmt 11.0.2, whose C++20 consteval path does not
44+
# compile with Xcode 26.4+. Keep only fmt on C++17 until RN is upgraded to
45+
# 0.83 or newer, which includes the upstream fmt fix.
46+
installer.pods_project.targets.each do |target|
47+
next unless target.name == 'fmt'
48+
49+
target.build_configurations.each do |build_configuration|
50+
build_configuration.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
51+
end
52+
end
53+
54+
# Embed TalsecRuntime when SPM is enabled.
55+
require_relative '../../freerasp_spm.rb'
56+
freerasp_embed_talsec_spm!(installer)
3457
end
3558
end

‎freerasp-react-native.podspec‎

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ require "json"
33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
44
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
55

6+
talsec_spm_path = File.expand_path('ios/TalsecRuntimePackage', __dir__)
7+
68
Pod::Spec.new do |s|
79
s.name = "freerasp-react-native"
810
s.version = package["version"]
@@ -14,14 +16,35 @@ Pod::Spec.new do |s|
1416
s.platforms = { :ios => "11.0" }
1517
s.source = { :git => "https://github.com/talsec/freerasp-react-native.git", :tag => "#{s.version}" }
1618

17-
s.source_files = 'ios/models/*.{h,m,mm,swift}',
18-
'ios/utils/*.{h,m,mm,swift}',
19-
'ios/dispatchers/*.{h,m,mm,swift}',
20-
'ios/*.{h,m,mm,swift}',
21-
'ios/TalsecRuntime.xcframework'
22-
s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
23-
s.ios.vendored_frameworks = "ios/TalsecRuntime.xcframework"
24-
19+
spm_requested = ENV['FREERASP_USE_SPM'] == '1'
20+
use_spm = spm_requested && respond_to?(:spm_dependency, true)
21+
22+
if spm_requested && !respond_to?(:spm_dependency, true)
23+
Pod::UI.warn '[freeRASP][SPM] React Native does not provide spm_dependency; using the vendored TalsecRuntime framework.'
24+
end
25+
26+
source_globs = [
27+
'ios/models/*.{h,m,mm,swift}',
28+
'ios/utils/*.{h,m,mm,swift}',
29+
'ios/dispatchers/*.{h,m,mm,swift}',
30+
'ios/*.{h,m,mm,swift}',
31+
]
32+
33+
if use_spm
34+
s.ios.deployment_target = '13.0'
35+
spm_dependency(s,
36+
url: talsec_spm_path,
37+
requirement: {},
38+
products: ['TalsecRuntime']
39+
)
40+
else
41+
source_globs << 'ios/TalsecRuntime.xcframework'
42+
s.xcconfig = { 'OTHER_LDFLAGS' => '-framework TalsecRuntime' }
43+
s.ios.vendored_frameworks = 'ios/TalsecRuntime.xcframework'
44+
end
45+
46+
s.source_files = source_globs
47+
2548
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
2649
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
2750
if respond_to?(:install_modules_dependencies, true)

‎freerasp_spm.rb‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Links and embeds the local TalsecRuntime Swift package.
2+
3+
def freerasp_embed_talsec_spm!(installer,
4+
package_path: File.expand_path('ios/TalsecRuntimePackage', __dir__),
5+
product: 'TalsecRuntime')
6+
7+
package_path = File.expand_path(package_path)
8+
local_pkg_class = Xcodeproj::Project::Object::XCLocalSwiftPackageReference
9+
remote_pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
10+
ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
11+
12+
spm_active = ENV['FREERASP_USE_SPM'] == '1' &&
13+
respond_to?(:spm_dependency, true)
14+
15+
if spm_active && !File.file?(File.join(package_path, 'Package.swift'))
16+
raise Pod::Informative, "[freeRASP][SPM] Package.swift not found at #{package_path}"
17+
end
18+
19+
projects_and_targets = {}
20+
pods_project = installer.pods_project
21+
projects_and_targets[pods_project] = pods_project.targets.select do |target|
22+
target.name == 'freerasp-react-native'
23+
end
24+
25+
installer.aggregate_targets.each do |aggregate_target|
26+
project = aggregate_target.user_project
27+
next if project.nil?
28+
29+
app_targets = aggregate_target.user_targets.select do |t|
30+
t.respond_to?(:product_type) && t.product_type == 'com.apple.product-type.application'
31+
end
32+
projects_and_targets[project] ||= []
33+
projects_and_targets[project].concat(app_targets)
34+
end
35+
36+
new_object = lambda do |project, klass|
37+
uuid = project.generate_uuid
38+
uuid = project.generate_uuid while project.objects_by_uuid.key?(uuid)
39+
object = klass.new(project, uuid)
40+
object.initialize_defaults
41+
object
42+
end
43+
44+
projects_and_targets.each do |project, targets|
45+
targets.uniq!
46+
47+
# Remove existing references before recreating them.
48+
owned_packages = []
49+
targets.each do |target|
50+
target.package_product_dependencies.select do |reference|
51+
reference.class == ref_class && reference.product_name == product
52+
end.each do |reference|
53+
owned_packages << reference.package unless reference.package.nil?
54+
reference.remove_from_project
55+
end
56+
end
57+
project.root_object.package_references.each do |package|
58+
reference_path =
59+
if package.class == local_pkg_class
60+
package.relative_path
61+
elsif package.class == remote_pkg_class
62+
package.repositoryURL
63+
end
64+
next if reference_path.nil?
65+
66+
owned_packages << package if File.basename(reference_path) == 'TalsecRuntimePackage'
67+
end
68+
owned_packages.uniq.each do |package|
69+
package.remove_from_project
70+
end
71+
72+
if spm_active
73+
pkg = new_object.call(project, local_pkg_class)
74+
pkg.relative_path = package_path
75+
project.root_object.package_references << pkg
76+
77+
targets.each do |target|
78+
Pod::UI.puts "[freeRASP][SPM] Linking #{product} to target #{target.name}"
79+
dep = new_object.call(project, ref_class)
80+
dep.package = pkg
81+
dep.product_name = product
82+
target.package_product_dependencies << dep
83+
end
84+
end
85+
86+
project.save
87+
end
88+
end

0 commit comments

Comments
 (0)