diff --git a/CHANGELOG.md b/CHANGELOG.md index 3468e17..12d0897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,20 @@ 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). +## [3.11.0] - 2024-11-19 + +### React Native + +#### Added + +- Added `adbEnabled` callback, which allows you to detect USB debugging option enabled in the developer settings on the device + +### Android + +#### Added + +- ADB detection feature + ## [3.10.0] - 2024-11-15 - Android SDK version: 12.0.0 diff --git a/android/build.gradle b/android/build.gradle index 15ad19e..49f62ac 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -90,7 +90,7 @@ dependencies { implementation "com.facebook.react:react-native:$react_native_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1" - implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:12.0.0" + implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:13.0.0" } if (isNewArchitectureEnabled()) { diff --git a/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt b/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt index d9facd8..1bf8f01 100644 --- a/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +++ b/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt @@ -55,6 +55,10 @@ internal object FreeraspThreatHandler : ThreatListener.ThreatDetected, ThreatLis listener?.threatDetected(Threat.DevMode) } + override fun onADBEnabledDetected() { + listener?.threatDetected(Threat.ADBEnabled) + } + override fun onSystemVPNDetected() { listener?.threatDetected(Threat.SystemVPN) } diff --git a/android/src/main/java/com/freeraspreactnative/Threat.kt b/android/src/main/java/com/freeraspreactnative/Threat.kt index d6fb7d0..32b8e0c 100644 --- a/android/src/main/java/com/freeraspreactnative/Threat.kt +++ b/android/src/main/java/com/freeraspreactnative/Threat.kt @@ -24,6 +24,7 @@ internal sealed class Threat(val value: Int) { object SystemVPN : Threat((10000..999999999).random()) object DevMode : Threat((10000..999999999).random()) object Malware : Threat((10000..999999999).random()) + object ADBEnabled : Threat((10000..999999999).random()) companion object { internal fun getThreatValues(): WritableArray { @@ -41,7 +42,8 @@ internal sealed class Threat(val value: Int) { UnofficialStore.value, ObfuscationIssues.value, DevMode.value, - Malware.value + Malware.value, + ADBEnabled.value ) ) } diff --git a/example/src/App.tsx b/example/src/App.tsx index a25d0f1..7ca5f25 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -32,7 +32,7 @@ const App = () => { // supportedAlternativeStores: ['storeOne', 'storeTwo'], malwareConfig: { blacklistedHashes: ['FgvSehLMM91E7lX/Zqp3u4jMmd0A7hH/Iqozu0TMVd0u'], - blacklistedPackageNames: ['com.wultra.app.screenlogger'], + blacklistedPackageNames: ['com.freeraspreactnativeexample'], suspiciousPermissions: [ [ 'android.permission.INTERNET', @@ -45,7 +45,7 @@ const App = () => { }, }, iosConfig: { - appBundleId: 'com.freeraspreactnativeexample', + appBundleId: 'org.reactjs.native.example.FreeraspReactNativeExample', appTeamId: 'your_team_ID', }, watcherMail: 'your_email_address@example.com', @@ -180,6 +180,14 @@ const App = () => { ) ); }, + // Android only + adbEnabled: () => { + setAppChecks((currentState) => + currentState.map((threat) => + threat.name === 'ADB Enabled' ? { ...threat, status: 'nok' } : threat + ) + ); + }, }; const addItemsToMalwareWhitelist = async () => { diff --git a/example/src/checks.ts b/example/src/checks.ts index 71a6a07..3dc76cf 100644 --- a/example/src/checks.ts +++ b/example/src/checks.ts @@ -17,4 +17,5 @@ export const androidChecks = [ { name: 'Obfuscation Issues', status: 'ok' }, { name: 'Developer Mode', status: 'ok' }, { name: 'Malware', status: 'ok' }, + { name: 'ADB Enabled', status: 'ok' }, ]; diff --git a/package.json b/package.json index cdcee11..c819046 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "freerasp-react-native", - "version": "3.10.0", + "version": "3.11.0", "description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/index.tsx b/src/index.tsx index 90bed0f..74f0908 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -117,6 +117,9 @@ export const setThreatListeners = async ( case Threat.Malware.value: config.malware?.(parseMalwareData(event[malwareKey])); break; + case Threat.ADBEnabled.value: + config.adbEnabled?.(); + break; default: onInvalidCallback(); break; diff --git a/src/threat.ts b/src/threat.ts index 0d71de7..5993a8b 100644 --- a/src/threat.ts +++ b/src/threat.ts @@ -17,6 +17,7 @@ export class Threat { static ObfuscationIssues = new Threat(0); static DevMode = new Threat(0); static Malware = new Threat(0); + static ADBEnabled = new Threat(0); constructor(value: number) { this.value = value; @@ -38,6 +39,7 @@ export class Threat { this.ObfuscationIssues, this.DevMode, this.Malware, + this.ADBEnabled, ] : [ this.AppIntegrity, diff --git a/src/types.ts b/src/types.ts index 135c76d..3ea0160 100644 --- a/src/types.ts +++ b/src/types.ts @@ -52,4 +52,5 @@ export type NativeEventEmitterActions = { devMode?: () => any; systemVPN?: () => any; malware?: (suspiciousApps: SuspiciousAppInfo[]) => any; + adbEnabled?: () => any; };