From 16ff6bd68f7a6722348157d137c2e99fd33d33c5 Mon Sep 17 00:00:00 2001 From: Sirack Date: Wed, 14 Jan 2026 12:02:11 +0300 Subject: [PATCH 1/7] feat: upgraded freeRASP SDK to 17.0.0 & implemented the additional callbacks (onMultiInstance, onUnsecureWiFi, onTimeSpoofing, onLocationSpoofing) --- .../Android/freeRASP.androidlib/build.gradle | 2 +- .../java/com/unity/free/rasp/Controller.java | 22 ++++++++++++++++++- Plugins/freeRASP/Talsec.cs | 12 ++++++++++ Plugins/iOS/NativeBridge.swift | 2 ++ Samples/freeRASPTestApp/Scripts/Game.cs | 16 ++++++++++++++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/Plugins/Android/freeRASP.androidlib/build.gradle b/Plugins/Android/freeRASP.androidlib/build.gradle index 5033411..9ab003d 100644 --- a/Plugins/Android/freeRASP.androidlib/build.gradle +++ b/Plugins/Android/freeRASP.androidlib/build.gradle @@ -33,7 +33,7 @@ android { dependencies { compileOnly files('libs/unity-classes.jar') // freeRASP SDK - implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:15.1.0' + implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:17.0.0' // test dep implementation("com.google.code.gson:gson:2.13.1") } diff --git a/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java b/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java index c20f8f9..021e094 100644 --- a/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java +++ b/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java @@ -126,5 +126,25 @@ public void onADBEnabledDetected() { @Override public void onSystemVPNDetected() { UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onSystemVPN"); - } + } + + @Override + public void onMultiInstanceDetected() { + UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onMultiInstance"); + } + + @Override + public void onUnsecureWifiDetected() { + UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onUnsecureWiFi"); + } + + @Override + public void onTimeSpoofingDetected() { + UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onTimeSpoofing"); + } + + @Override + public void onLocationSpoofingDetected() { + UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onLocationSpoofing"); + } } \ No newline at end of file diff --git a/Plugins/freeRASP/Talsec.cs b/Plugins/freeRASP/Talsec.cs index 510344f..9b90f8e 100644 --- a/Plugins/freeRASP/Talsec.cs +++ b/Plugins/freeRASP/Talsec.cs @@ -178,6 +178,18 @@ private void scanResult(string talsecScanResultCallback) case "onADBEnabled": this.threatDetectedCallback.onADBEnabled(); break; + case "onMultiInstance": + this.threatDetectedCallback.onMultiInstance(); + break; + case "onUnsecureWiFi": + this.threatDetectedCallback.onUnsecureWiFi(); + break; + case "onTimeSpoofing": + this.threatDetectedCallback.onTimeSpoofing(); + break; + case "onLocationSpoofing": + this.threatDetectedCallback.onLocationSpoofing(); + break; } } } diff --git a/Plugins/iOS/NativeBridge.swift b/Plugins/iOS/NativeBridge.swift index b034e63..cb26f16 100644 --- a/Plugins/iOS/NativeBridge.swift +++ b/Plugins/iOS/NativeBridge.swift @@ -40,6 +40,8 @@ extension SecurityThreatCenter: SecurityThreatHandler { message = "onScreenshot" case .screenRecording: message = "screenRecording" + case .timeSpoofing: + message = "onTimeSpoofing" } message.withCString { messagePtr in diff --git a/Samples/freeRASPTestApp/Scripts/Game.cs b/Samples/freeRASPTestApp/Scripts/Game.cs index 0c1c488..2a2238a 100644 --- a/Samples/freeRASPTestApp/Scripts/Game.cs +++ b/Samples/freeRASPTestApp/Scripts/Game.cs @@ -102,4 +102,20 @@ public void onSystemVPN() { Debug.Log("Unity - System VPN detected"); } + public void onMultiInstance() { + Debug.Log("Unity - Multi instance detected"); + } + + public void onUnsecureWiFi() { + Debug.Log("Unity - Unsecure WiFi detected"); + } + + public void onTimeSpoofing() { + Debug.Log("Unity - Time spoofing detected"); + } + + public void onLocationSpoofing() { + Debug.Log("Unity - Location spoofing detected"); + } + } \ No newline at end of file From 83d6e5911c9d5e719fe0499891de7c78a9cee42e Mon Sep 17 00:00:00 2001 From: Sirack Date: Tue, 20 Jan 2026 17:00:21 +0300 Subject: [PATCH 2/7] fix: use unity flavour for TalsecSecurity-Community --- Plugins/Android/freeRASP.androidlib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Android/freeRASP.androidlib/build.gradle b/Plugins/Android/freeRASP.androidlib/build.gradle index 9ab003d..74e2b2c 100644 --- a/Plugins/Android/freeRASP.androidlib/build.gradle +++ b/Plugins/Android/freeRASP.androidlib/build.gradle @@ -33,7 +33,7 @@ android { dependencies { compileOnly files('libs/unity-classes.jar') // freeRASP SDK - implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:17.0.0' + implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community-Unity:17.0.0' // test dep implementation("com.google.code.gson:gson:2.13.1") } From 138a3e70350ff6c3c991e4f9785eaecdd11b398d Mon Sep 17 00:00:00 2001 From: Sirack Date: Tue, 20 Jan 2026 17:16:25 +0300 Subject: [PATCH 3/7] fix: missing callbacks added to ThreatDetectedCallback --- Plugins/freeRASP/ThreatDetectedCallback.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/freeRASP/ThreatDetectedCallback.cs b/Plugins/freeRASP/ThreatDetectedCallback.cs index 2772998..a0b9c88 100644 --- a/Plugins/freeRASP/ThreatDetectedCallback.cs +++ b/Plugins/freeRASP/ThreatDetectedCallback.cs @@ -21,4 +21,8 @@ public interface ThreatDetectedCallback void onDevMode(); void onADBEnabled(); void onSystemVPN(); + void onMultiInstance(); + void onUnsecureWiFi(); + void onTimeSpoofing(); + void onLocationSpoofing(); } \ No newline at end of file From f4a861336cce3306cb995a11a9b68c30972c4a36 Mon Sep 17 00:00:00 2001 From: Sirack Date: Tue, 20 Jan 2026 20:14:52 +0300 Subject: [PATCH 4/7] feat: upgrade TalsecSecurity Community sdk version to 17.0.1 --- Plugins/Android/freeRASP.androidlib/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Android/freeRASP.androidlib/build.gradle b/Plugins/Android/freeRASP.androidlib/build.gradle index 74e2b2c..76fce8a 100644 --- a/Plugins/Android/freeRASP.androidlib/build.gradle +++ b/Plugins/Android/freeRASP.androidlib/build.gradle @@ -33,7 +33,7 @@ android { dependencies { compileOnly files('libs/unity-classes.jar') // freeRASP SDK - implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community-Unity:17.0.0' + implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community-Unity:17.0.1' // test dep implementation("com.google.code.gson:gson:2.13.1") } From 6c5b9acf91a8c147a25ef5b66cee8c784083b713 Mon Sep 17 00:00:00 2001 From: Sirack Date: Wed, 21 Jan 2026 12:03:19 +0300 Subject: [PATCH 5/7] fix: removed timeSpoofing enum (ios) as we are using v6.13.0. Time spoofing for ios was added v6.14.0 --- Plugins/iOS/NativeBridge.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Plugins/iOS/NativeBridge.swift b/Plugins/iOS/NativeBridge.swift index cb26f16..b034e63 100644 --- a/Plugins/iOS/NativeBridge.swift +++ b/Plugins/iOS/NativeBridge.swift @@ -40,8 +40,6 @@ extension SecurityThreatCenter: SecurityThreatHandler { message = "onScreenshot" case .screenRecording: message = "screenRecording" - case .timeSpoofing: - message = "onTimeSpoofing" } message.withCString { messagePtr in From 676020cab394c245e853a51aad4cd49a7eb4240e Mon Sep 17 00:00:00 2001 From: Sirack Date: Fri, 23 Jan 2026 10:39:47 +0300 Subject: [PATCH 6/7] feat: RASP Status callback added --- .../java/com/unity/free/rasp/Controller.java | 23 ++++++++++++++++--- Plugins/freeRASP/RASPStatusCallback.cs | 8 +++++++ Plugins/freeRASP/RASPStatusCallback.cs.meta | 2 ++ Plugins/freeRASP/Talsec.cs | 9 ++++++++ Plugins/iOS/NativeBridge.swift | 2 ++ 5 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Plugins/freeRASP/RASPStatusCallback.cs create mode 100644 Plugins/freeRASP/RASPStatusCallback.cs.meta diff --git a/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java b/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java index 021e094..ccc4273 100644 --- a/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java +++ b/Plugins/Android/freeRASP.androidlib/src/main/java/com/unity/free/rasp/Controller.java @@ -6,6 +6,7 @@ import com.aheaditec.talsec_security.security.api.SuspiciousAppInfo; import com.aheaditec.talsec_security.security.api.Talsec; import com.aheaditec.talsec_security.security.api.TalsecConfig; +import com.aheaditec.talsec_security.security.api.TalsecMode; import com.aheaditec.talsec_security.security.api.ThreatListener; import java.util.List; @@ -13,10 +14,25 @@ public class Controller implements ThreatListener.ThreatDetected, ThreatListener.DeviceState { private static final String TAG = Controller.class.getSimpleName(); + + public static class AppRaspExecutionState extends ThreatListener.RaspExecutionState { + private String gameObjectName; + public void setGameObjectCallback(String gameObjectName) { + this.gameObjectName = gameObjectName; + } + @Override + public void onAllChecksFinished() { + UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onAllChecksFinished"); + } + } + private boolean talSecInitialized; private String gameObjectName; + private AppRaspExecutionState appRaspExecutionState; + public Controller() { talSecInitialized = false; + appRaspExecutionState = new AppRaspExecutionState(); } public void initializeTalsec(Context context, String packageName, @@ -30,9 +46,9 @@ public void initializeTalsec(Context context, String packageName, .watcherMail(watcherEmailAddress) .prod(isProd) .build(); - ThreatListener threatListener = new ThreatListener(this, this); + ThreatListener threatListener = new ThreatListener(this, this, appRaspExecutionState); threatListener.registerListener(context); - Talsec.start(context, config); + Talsec.start(context, config, TalsecMode.BACKGROUND); talSecInitialized = true; } } @@ -46,6 +62,7 @@ public void stopTalsec() { public void setUnityGameObjectCallback(String gameObjectName) { this.gameObjectName = gameObjectName; + this.appRaspExecutionState.setGameObjectCallback(this.gameObjectName); } @Override @@ -126,7 +143,7 @@ public void onADBEnabledDetected() { @Override public void onSystemVPNDetected() { UnityPlayer.UnitySendMessage(this.gameObjectName, "scanResult", "onSystemVPN"); - } + } @Override public void onMultiInstanceDetected() { diff --git a/Plugins/freeRASP/RASPStatusCallback.cs b/Plugins/freeRASP/RASPStatusCallback.cs new file mode 100644 index 0000000..3995764 --- /dev/null +++ b/Plugins/freeRASP/RASPStatusCallback.cs @@ -0,0 +1,8 @@ + +using System.Collections.Generic; +using UnityEngine; + +public interface RASPStatusCallback +{ + void onAllChecksFinished(); +} \ No newline at end of file diff --git a/Plugins/freeRASP/RASPStatusCallback.cs.meta b/Plugins/freeRASP/RASPStatusCallback.cs.meta new file mode 100644 index 0000000..e9ca13a --- /dev/null +++ b/Plugins/freeRASP/RASPStatusCallback.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 47088122d18c0454a9047720cdb9b6d2 \ No newline at end of file diff --git a/Plugins/freeRASP/Talsec.cs b/Plugins/freeRASP/Talsec.cs index 9b90f8e..35583ef 100644 --- a/Plugins/freeRASP/Talsec.cs +++ b/Plugins/freeRASP/Talsec.cs @@ -20,6 +20,7 @@ public class TalsecPlugin : MonoBehaviour // Singleton instance private static TalsecPlugin _instance; private ThreatDetectedCallback threatDetectedCallback; + private RASPStatusCallback raspStatusCallback; private AndroidJavaObject javaControllerObject; // Public accessor for the instance @@ -120,6 +121,10 @@ public void setThreatDetectedCallback(ThreatDetectedCallback callback) { this.threatDetectedCallback = callback; } + public void setRASPStatusCallback(RASPStatusCallback callback) { + this.raspStatusCallback = callback; + } + // This method will be called from the native side of the code // both iOS & Android will use this method // hence all the threat types for both platforms are handled here @@ -127,6 +132,10 @@ private void scanResult(string talsecScanResultCallback) { if(this.threatDetectedCallback != null) { switch(talsecScanResultCallback) { + case "onAllChecksFinished": + if(this.raspStatusCallback != null) + this.raspStatusCallback.onAllChecksFinished(); + break; case "onAppIntegrity": this.threatDetectedCallback.onAppIntegrity(); break; diff --git a/Plugins/iOS/NativeBridge.swift b/Plugins/iOS/NativeBridge.swift index b034e63..cb26f16 100644 --- a/Plugins/iOS/NativeBridge.swift +++ b/Plugins/iOS/NativeBridge.swift @@ -40,6 +40,8 @@ extension SecurityThreatCenter: SecurityThreatHandler { message = "onScreenshot" case .screenRecording: message = "screenRecording" + case .timeSpoofing: + message = "onTimeSpoofing" } message.withCString { messagePtr in From 5817dc6bb6c8b7b99726426c4dc061cbd96b82ab Mon Sep 17 00:00:00 2001 From: Sirack Date: Fri, 23 Jan 2026 10:57:59 +0300 Subject: [PATCH 7/7] feat: onAllChecksFinished callback added to NativeBridge.swift --- Plugins/iOS/NativeBridge.swift | 9 ++++++++- Samples/freeRASPTestApp/Scripts/Game.cs | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/iOS/NativeBridge.swift b/Plugins/iOS/NativeBridge.swift index cb26f16..e1b1020 100644 --- a/Plugins/iOS/NativeBridge.swift +++ b/Plugins/iOS/NativeBridge.swift @@ -6,7 +6,14 @@ import TalsecRuntime @_silgen_name("send_message_to_unity") func send_message_to_unity(_ threatType: UnsafePointer) -extension SecurityThreatCenter: SecurityThreatHandler { +extension SecurityThreatCenter: SecurityThreatHandler, RaspExecutionState { + + public func onAllChecksFinished() { + "onAllChecksFinished".withCString { messagePtr in + send_message_to_unity(messagePtr) + } + } + public func threatDetected(_ securityThreat: TalsecRuntime.SecurityThreat) { var message = "unknown"; diff --git a/Samples/freeRASPTestApp/Scripts/Game.cs b/Samples/freeRASPTestApp/Scripts/Game.cs index 2a2238a..0db5f47 100644 --- a/Samples/freeRASPTestApp/Scripts/Game.cs +++ b/Samples/freeRASPTestApp/Scripts/Game.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; -public class Game : MonoBehaviour, ThreatDetectedCallback +public class Game : MonoBehaviour, ThreatDetectedCallback, RASPStatusCallback { // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() @@ -18,11 +18,17 @@ void Start() packageName = "com.unity.freeRASP", signingCertificateHashBase64 = new string[] { "Tmac/QIomCqEGS1jYqy9cMMrqaitVoZLpjXzCMnt55Q=" }, supportedAlternativeStores = new string[] { "com.sec.android.app.samsungapps" } + }, + iosConfig = new IOSConfig + { + appBundleIds = new string[] { "com.unity.freeRASP" }, + appTeamId = "TEAM ID" } }; // set callback TalsecPlugin.Instance.setThreatDetectedCallback(this); + TalsecPlugin.Instance.setRASPStatusCallback(this); // initialize talsec with new unified config TalsecPlugin.Instance.initTalsec(config); } @@ -118,4 +124,9 @@ public void onLocationSpoofing() { Debug.Log("Unity - Location spoofing detected"); } + public void onAllChecksFinished() + { + Debug.Log("Unity - All checks finished"); + } + } \ No newline at end of file