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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 3 additions & 1 deletion android/src/main/java/com/freeraspreactnative/Threat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -41,7 +42,8 @@ internal sealed class Threat(val value: Int) {
UnofficialStore.value,
ObfuscationIssues.value,
DevMode.value,
Malware.value
Malware.value,
ADBEnabled.value
)
)
}
Expand Down
12 changes: 10 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -45,7 +45,7 @@ const App = () => {
},
},
iosConfig: {
appBundleId: 'com.freeraspreactnativeexample',
appBundleId: 'org.reactjs.native.example.FreeraspReactNativeExample',
appTeamId: 'your_team_ID',
},
watcherMail: '[email protected]',
Expand Down Expand Up @@ -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 () => {
Expand Down
1 change: 1 addition & 0 deletions example/src/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export const setThreatListeners = async <T extends NativeEventEmitterActions>(
case Threat.Malware.value:
config.malware?.(parseMalwareData(event[malwareKey]));
break;
case Threat.ADBEnabled.value:
config.adbEnabled?.();
break;
default:
onInvalidCallback();
break;
Expand Down
2 changes: 2 additions & 0 deletions src/threat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,6 +39,7 @@ export class Threat {
this.ObfuscationIssues,
this.DevMode,
this.Malware,
this.ADBEnabled,
]
: [
this.AppIntegrity,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ export type NativeEventEmitterActions = {
devMode?: () => any;
systemVPN?: () => any;
malware?: (suspiciousApps: SuspiciousAppInfo[]) => any;
adbEnabled?: () => any;
};
Loading