react-native-security-checker
Version:
A comprehensive React Native security checker that detects jailbreak, root, emulators, hooks, tampering, and other security threats
119 lines (104 loc) • 3.33 kB
text/typescript
import { NativeModules } from 'react-native';
export interface RootDetectionDetails {
rootBeerIsRooted: boolean;
rootBeerIsRootedWithoutBusyBoxCheck: boolean;
detectRootManagementApps: boolean;
detectPotentiallyDangerousApps: boolean;
detectTestKeys: boolean;
checkForBusyBoxBinary: boolean;
checkForSuBinary: boolean;
checkSuExists: boolean;
checkForRWPaths: boolean;
checkForDangerousProps: boolean;
checkForMagiskBinary: boolean;
customRootAppsCheck: boolean;
customRootFilesCheck: boolean;
customDangerousPropsCheck: boolean;
customSuBinaryCheck: boolean;
customRootNativeCheck: boolean;
customBusyBoxCheck: boolean;
}
export interface SecurityMessage {
type: 'warning' | 'info' | 'error';
code: string;
title: string;
message: string;
suggestion?: string;
severity: 'low' | 'medium' | 'high' | 'critical';
actionable: boolean;
}
export interface SecurityCheckConfig {
// Basic Security Checks
checkWorkProfile?: boolean;
checkCloned?: boolean;
checkSecondaryUser?: boolean;
checkRooted?: boolean;
checkEmulator?: boolean;
checkDebuggable?: boolean;
checkDeveloperMode?: boolean;
checkUSBDebugging?: boolean;
checkVPN?: boolean;
checkHooked?: boolean;
checkTampered?: boolean;
checkVirtualSpace?: boolean;
checkSuspiciousApps?: boolean;
checkSandbox?: boolean;
checkJailbroken?: boolean;
checkDebugging?: boolean;
checkSimulator?: boolean;
// Advanced Security Checks
checkDebuggerAttached?: boolean;
checkRunningInBackground?: boolean;
checkProxy?: boolean;
checkNetworkMonitoring?: boolean;
checkBiometricCompromised?: boolean;
checkPerformanceAnomaly?: boolean;
checkRuntimeIntegrity?: boolean;
checkInternet?: boolean;
// Root Detection Details
includeRootDetails?: boolean;
// Performance Options
enableFastMode?: boolean; // Skip expensive checks
enableDetailedChecks?: boolean; // Include detailed analysis
// User Messages
includeUserMessages?: boolean; // Include user-readable messages
}
export interface SecurityCheckResult {
// Basic Security Checks
isWorkProfile?: boolean;
isCloned?: boolean;
isSecondaryUser?: boolean;
isRooted?: boolean;
isEmulator?: boolean;
isDebuggable?: boolean;
isDeveloperModeOn?: boolean;
isUSBDebuggingOn?: boolean;
isVPNActive?: boolean;
isHooked?: boolean;
isTampered?: boolean;
isRunningInVirtualSpace?: boolean;
hasSuspiciousApps?: boolean;
isRunningInSandbox?: boolean;
isJailbroken?: boolean;
isDebugging?: boolean;
isRunningInSimulator?: boolean;
// Advanced Security Checks
isDebuggerAttached?: boolean;
isRunningInBackground?: boolean;
isProxyDetected?: boolean;
isNetworkMonitoring?: boolean;
isBiometricCompromised?: boolean;
isPerformanceAnomaly?: boolean;
isRuntimeIntegrityCompromised?: boolean;
isInternetOff?: boolean;
// Detailed Analysis
rootDetectionDetails?: RootDetectionDetails;
// User Messages
messages?: SecurityMessage[];
// Overall Security Status
isInsecureEnvironment: boolean;
}
export interface Spec {
detectEnvironment(config?: SecurityCheckConfig): Promise<SecurityCheckResult>;
}
export default NativeModules.SecurityChecker as Spec;