Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.0] - 2026-11-11

- Android SDK version: 20.0.1
- iOS SDK version: 8.0.1

### Breaking

- `allChecksFinished` RASP execution state action renamed to `fastChecksFinished`. On Android, it is triggered when the fast checks are completed, while the postponed checks may still run; on iOS, when all checks are completed
- `TalsecIosConfig.appBundleId` (string) replaced by `appBundleIds` (string[]), matching the iOS SDK
- Methods that resolved with a status string or a constant now resolve to `void`: `startFreeRASP`, `addToWhitelist`, `blockScreenCapture`, `blockScreenControl`, `startOngoingCallDetection`, `stopOngoingCallDetection`, `storeExternalId`, `removeExternalId`
- All methods now reject with `TalsecError` (`code`: `talsec-failure`, `unsupported-platform`, `configuration-exception`, `external-id-failure`, `malware-failure`) instead of native errors or plain strings
- `onInvalidCallback` no longer exported; use `abortApp` to terminate the app
- The `TalsecPlugin` interface of the native bridge is no longer exported; use the exported functions instead

### Capacitor

#### Added

- `ongoingCall` threat action with the new `CallState` type (`'STARTED' | 'ONGOING' | 'STOPPED'`), driven by `startOngoingCallDetection()` and `stopOngoingCallDetection()` (Android only)
- `blockScreenControl()` and `isScreenControlBlocked()` to prevent accessibility services from reading or controlling the app screen (Android only)
- `blockOverlayWindows()` and `isOverlayWindowsBlocked()` to hide overlay windows of other apps (Android 12+ only, requires the `HIDE_OVERLAY_WINDOWS` permission)
- `criticalChecksFinished` and `postponedChecksFinished` RASP execution state actions (Android only)

#### Changed

- Android package (namespace) of the plugin renamed from `com.aheaditec.freerasp` to `app.talsec.rasp.capacitor`, following the Android SDK's `app.talsec.rasp`
- On Android, `isScreenCaptureBlocked()` reports the protection state of the current activity
- On Android, freeRASP now starts in background mode (`TalsecMode.BACKGROUND`), so the initialization and synchronous checks no longer run on the main thread
- Threat and RASP execution state actions are typed as returning `void` instead of `any`

### Android

#### Fixed

- Improved hook detection to prevent collisions with running VPN services and to better work with the device resources (threads/RAM)
- Fixed a release crash during root detection when a checked package is not installed
- Fixed a crash in `ScreenProtector.unregisterScreenCallbacks` on Android 15+ when several activities registered screen callbacks
- Fixed intermittent build failures of apps using the SDK (`NullPointerException: Cannot read field "d"`, shown by Gradle as `[CIRCULAR REFERENCE]`) caused by invalid bytecode in some SDK builds
- Fixed `killOnBypass` closing the app when the same threat was reported twice in quick succession

#### Changed

- Deprecated the freeRASP Maven coordinates (`com.aheaditec.talsec.security:TalsecSecurity-{flavor}`)
- Improved Bootloader detection
- Extended emulator detection with additional device-property and ABI checks
- Improved logging structure and data enrichment for better Portal insights/reports
- Refactoring of the time spoofing detection which improves the performance of the freeRASP check execution
- Improved the performance of the App integrity check
- Updated CA bundle

## [3.3.0] - 2026-11-09

- Android SDK version: 19.3.1
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Key features are the detection and prevention of
- Unlocked or compromised bootloader
- Hooking framework (e.g., Frida, LSPosed, Shadow)
- UI automation and driven-input attacks (e.g., Appium)
- Ongoing cellular and VoIP calls during sensitive flows (Android)
- Screen control by accessibility services and overlay windows of other apps (Android)
- Untrusted installation method
- App Data Migration protection

Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ apply plugin: 'kotlinx-serialization'
apply plugin: 'app.talsec.plugin'

android {
namespace "com.aheaditec.freerasp"
namespace "app.talsec.rasp.capacitor"
talsec {
sdkVersion = "19.3.1"
sdkVersion = "20.0.1"
platform = "Capacitor"
}
compileSdk Math.max(36, project.hasProperty('rootProject.ext.compileSdk') ? rootProject.ext.compileSdk as int : 36)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.aheaditec.freerasp
package app.talsec.rasp.capacitor

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.os.Build
import android.os.Handler
Expand All @@ -8,23 +10,26 @@ import android.os.Looper
import app.talsec.rasp.security.api.SuspiciousAppInfo
import app.talsec.rasp.security.api.Talsec
import app.talsec.rasp.security.api.TalsecConfig
import com.aheaditec.freerasp.dispatchers.ExecutionStateDispatcher
import com.aheaditec.freerasp.dispatchers.ThreatDispatcher
import com.aheaditec.freerasp.utils.Utils
import com.aheaditec.freerasp.utils.getArraySafe
import com.aheaditec.freerasp.utils.toEncodedJSArray
import com.aheaditec.freerasp.utils.toSuspiciousAppDetectionConfig
import com.aheaditec.freerasp.events.BaseRaspEvent
import com.aheaditec.freerasp.events.RaspExecutionStateEvent
import com.aheaditec.freerasp.events.ThreatEvent
import com.aheaditec.freerasp.interfaces.PluginExecutionStateListener
import com.aheaditec.freerasp.interfaces.PluginThreatListener
import app.talsec.rasp.security.api.TalsecMode
import app.talsec.rasp.security.api.ThreatListener.CallState
import app.talsec.rasp.capacitor.dispatchers.ExecutionStateDispatcher
import app.talsec.rasp.capacitor.dispatchers.ThreatDispatcher
import app.talsec.rasp.capacitor.utils.Utils
import app.talsec.rasp.capacitor.utils.getArraySafe
import app.talsec.rasp.capacitor.utils.toEncodedJSArray
import app.talsec.rasp.capacitor.utils.toSuspiciousAppDetectionConfig
import app.talsec.rasp.capacitor.events.BaseRaspEvent
import app.talsec.rasp.capacitor.events.RaspExecutionStateEvent
import app.talsec.rasp.capacitor.events.ThreatEvent
import app.talsec.rasp.capacitor.interfaces.PluginExecutionStateListener
import app.talsec.rasp.capacitor.interfaces.PluginThreatListener
import com.getcapacitor.JSObject
import com.getcapacitor.Plugin
import com.getcapacitor.PluginCall
import com.getcapacitor.PluginMethod
import com.getcapacitor.annotation.CapacitorPlugin
import org.json.JSONArray
import java.lang.ref.WeakReference

typealias CapacitorCallback = (String, JSObject) -> Unit

Expand Down Expand Up @@ -53,7 +58,7 @@ class FreeraspPlugin : Plugin() {
PluginThreatHandler.registerSDKListener(context)

bridge.activity.runOnUiThread {
Talsec.start(context, talsecConfig)
Talsec.start(context, talsecConfig, TalsecMode.BACKGROUND)
mainHandler.post {
talsecStarted = true
// This code must be called only AFTER Talsec.start
Expand Down Expand Up @@ -107,6 +112,7 @@ class FreeraspPlugin : Plugin() {
ScreenProtector.unregister(activity)
}
if (activity.isFinishing) {
stopOngoingCallDetectionInternal()
ThreatDispatcher.unregisterListener()
ExecutionStateDispatcher.unregisterListener()
PluginThreatHandler.unregisterSDKListener(context)
Expand Down Expand Up @@ -151,13 +157,16 @@ class FreeraspPlugin : Plugin() {

/**
* Method to setup the message passing between native and Capacitor
* @return list of [CHANNEL_NAME, CHANNEL_KEY, MALWARE_CHANNEL_KEY]
* @return list of [CHANNEL_NAME, CHANNEL_KEY, MALWARE_CHANNEL_KEY, CALL_STATE_CHANNEL_KEY]
*/
@PluginMethod
fun getThreatChannelData(call: PluginCall) {
val channelData = JSONArray(
(listOf(
ThreatEvent.CHANNEL_NAME, ThreatEvent.CHANNEL_KEY, ThreatEvent.MALWARE_CHANNEL_KEY
ThreatEvent.CHANNEL_NAME,
ThreatEvent.CHANNEL_KEY,
ThreatEvent.MALWARE_CHANNEL_KEY,
ThreatEvent.CALL_STATE_CHANNEL_KEY
))
)
call.resolve(JSObject().put("ids", channelData))
Expand Down Expand Up @@ -259,8 +268,15 @@ class FreeraspPlugin : Plugin() {
*/
@PluginMethod
fun isScreenCaptureBlocked(call: PluginCall) {
val currentActivity = activity ?: run {
call.reject(
"Cannot check screen capture state, activity is null.",
"IsScreenCaptureBlockedError"
)
return
}
try {
val isBlocked = Talsec.isScreenCaptureBlocked()
val isBlocked = Talsec.isScreenCaptureBlocked(currentActivity)
call.resolve(JSObject().put("result", isBlocked))
} catch (e: Exception) {
call.reject(
Expand All @@ -270,6 +286,161 @@ class FreeraspPlugin : Plugin() {
}
}

/**
* Method to block accessibility services from reading or controlling the screen
* @param enable Pass `true` to block screen control, `false` to enable it
*/
@PluginMethod
fun blockScreenControl(call: PluginCall) {
val enable = call.getBoolean("enable") ?: run {
call.reject(
"Enable argument is missing or not a boolean.", "MissingArgumentError"
)
return
}

activity?.runOnUiThread {
try {
Talsec.blockScreenControl(activity, enable)
call.resolve(JSObject().put("result", true))
} catch (e: Exception) {
call.reject(
"Error while setting screen control: ${e.message}", "BlockScreenControlError"
)
}
} ?: run {
call.reject("Cannot block screen control, activity is null.", "BlockScreenControlError")
}
}

/**
* Method to check if screen control is currently blocked
*/
@PluginMethod
fun isScreenControlBlocked(call: PluginCall) {
val currentActivity = activity ?: run {
call.reject(
"Cannot check screen control state, activity is null.",
"IsScreenControlBlockedError"
)
return
}
try {
call.resolve(JSObject().put("result", Talsec.isScreenControlBlocked(currentActivity)))
} catch (e: Exception) {
call.reject(
"Error while checking if screen control is blocked: ${e.message}",
"IsScreenControlBlockedError"
)
}
}

/**
* Method to hide overlay windows of other apps over the activity.
* Requires Android 12+ and the HIDE_OVERLAY_WINDOWS permission.
* @param enable Pass `true` to hide overlay windows, `false` to show them
* @return whether the request was applied
*/
// Missing permission is suppressed because the decision to use the overlay API is made
// by developer, and not enforced by the library.
@SuppressLint("MissingPermission")
@PluginMethod
fun blockOverlayWindows(call: PluginCall) {
val enable = call.getBoolean("enable") ?: run {
call.reject(
"Enable argument is missing or not a boolean.", "MissingArgumentError"
)
return
}

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
call.resolve(JSObject().put("result", false))
return
}

activity?.runOnUiThread {
try {
call.resolve(JSObject().put("result", Talsec.blockOverlayWindows(activity, enable)))
} catch (e: Exception) {
call.reject(
"Error while setting overlay windows: ${e.message}", "BlockOverlayWindowsError"
)
}
} ?: run {
call.reject("Cannot block overlay windows, activity is null.", "BlockOverlayWindowsError")
}
}

/**
* Method to check if overlay windows of other apps are currently hidden
*/
@PluginMethod
fun isOverlayWindowsBlocked(call: PluginCall) {
val currentActivity = activity ?: run {
call.reject(
"Cannot check overlay windows state, activity is null.",
"IsOverlayWindowsBlockedError"
)
return
}
try {
call.resolve(JSObject().put("result", Talsec.isOverlayWindowsBlocked(currentActivity)))
} catch (e: Exception) {
call.reject(
"Error while checking if overlay windows are blocked: ${e.message}",
"IsOverlayWindowsBlockedError"
)
}
}

/**
* Method to start the ongoing call (cellular and VoIP) detection for the current activity
*/
@PluginMethod
fun startOngoingCallDetection(call: PluginCall) {
val currentActivity = activity ?: run {
call.reject(
"Cannot start ongoing call detection, activity is null.",
"OngoingCallDetectionError"
)
return
}
try {
if (ongoingCallActivity?.get() !== currentActivity) {
stopOngoingCallDetectionInternal()
Talsec.startOngoingCallDetection(currentActivity)
ongoingCallActivity = WeakReference(currentActivity)
}
call.resolve(JSObject().put("result", true))
} catch (e: Exception) {
call.reject(
"Error while starting ongoing call detection: ${e.message}",
"OngoingCallDetectionError"
)
}
}

/**
* Method to stop the ongoing call detection
*/
@PluginMethod
fun stopOngoingCallDetection(call: PluginCall) {
try {
stopOngoingCallDetectionInternal()
call.resolve(JSObject().put("result", true))
} catch (e: Exception) {
call.reject(
"Error while stopping ongoing call detection: ${e.message}",
"OngoingCallDetectionError"
)
}
}

private fun stopOngoingCallDetectionInternal() {
ongoingCallActivity?.get()?.let { Talsec.stopOngoingCallDetection(it) }
ongoingCallActivity = null
}

@PluginMethod
fun storeExternalId(call: PluginCall) {
val externalId = call.getString("data")
Expand Down Expand Up @@ -331,6 +502,9 @@ class FreeraspPlugin : Plugin() {
private val mainHandler = Handler(Looper.getMainLooper())

internal var talsecStarted = false

// Ongoing call detection is registered per activity
private var ongoingCallActivity: WeakReference<Activity>? = null
}

internal class PluginListener(
Expand All @@ -345,6 +519,13 @@ class FreeraspPlugin : Plugin() {
notifyMalware(suspiciousApps, context, pluginCallback)
}

override fun ongoingCallDetected(state: CallState) {
val params = JSObject()
.put(ThreatEvent.CHANNEL_KEY, ThreatEvent.OngoingCall.value)
.put(ThreatEvent.CALL_STATE_CHANNEL_KEY, state.name)
pluginCallback(ThreatEvent.CHANNEL_NAME, params)
}

override fun raspExecutionStateChanged(event: RaspExecutionStateEvent) {
notifyEvent(event, pluginCallback)
}
Expand Down
Loading
Loading