react-native-device-defense 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -260,12 +260,7 @@ static bool checkSSLValidationBypass() {
|
|
|
260
260
|
LOGD("Found SSL validation bypass in %s", propFile.c_str());
|
|
261
261
|
return true;
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
line.find("1") != std::string::npos) {
|
|
265
|
-
// Debuggable builds may have SSL validation bypassed
|
|
266
|
-
LOGD("Device is debuggable, SSL may be bypassed");
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
263
|
+
|
|
269
264
|
}
|
|
270
265
|
}
|
|
271
266
|
|
|
@@ -485,15 +480,9 @@ static bool performRootDetection() {
|
|
|
485
480
|
return true;
|
|
486
481
|
}
|
|
487
482
|
|
|
488
|
-
// Check system properties
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// Check mount points
|
|
494
|
-
if (checkMountPoints()) {
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
483
|
+
// Check system properties and mount points are skipped here as they
|
|
484
|
+
// frequently cause false positives on unrooted userdebug/developer devices
|
|
485
|
+
// (e.g., when USB debugging is enabled).
|
|
497
486
|
|
|
498
487
|
return false;
|
|
499
488
|
}
|
|
@@ -28,7 +28,15 @@ class RootDetection(private val context: Context) {
|
|
|
28
28
|
*/
|
|
29
29
|
fun performDetection(): RootDetectionResult {
|
|
30
30
|
val rootBeer = RootBeer(context)
|
|
31
|
-
|
|
31
|
+
// Only use reliable RootBeer checks to avoid false positives (like checkForDangerousProps or checkForRWPaths)
|
|
32
|
+
val hasRootBeerDetected = rootBeer.detectRootManagementApps() ||
|
|
33
|
+
rootBeer.detectPotentiallyDangerousApps() ||
|
|
34
|
+
rootBeer.checkForSuBinary() ||
|
|
35
|
+
rootBeer.checkForBusyBoxBinary() ||
|
|
36
|
+
rootBeer.detectTestKeys() ||
|
|
37
|
+
rootBeer.checkSuExists() ||
|
|
38
|
+
rootBeer.checkForRootNative() ||
|
|
39
|
+
rootBeer.checkForMagiskBinary()
|
|
32
40
|
|
|
33
41
|
// Native detection (JNI)
|
|
34
42
|
val hasNativeRootDetected = NativeSecurityCheck.isRooted()
|
|
@@ -39,7 +47,7 @@ class RootDetection(private val context: Context) {
|
|
|
39
47
|
// Check for root management apps
|
|
40
48
|
val hasRootApps = checkRootApps()
|
|
41
49
|
|
|
42
|
-
// Check system properties
|
|
50
|
+
// Check system properties (keep for details, but don't use for blocking)
|
|
43
51
|
val hasSystemPropsModified = checkSystemProperties()
|
|
44
52
|
|
|
45
53
|
val details = mapOf(
|
|
@@ -54,11 +62,11 @@ class RootDetection(private val context: Context) {
|
|
|
54
62
|
"dangerous_props" to checkDangerousSystemProperties()
|
|
55
63
|
)
|
|
56
64
|
|
|
65
|
+
// Exclude system properties from the final isRooted flag to avoid false positives on userdebug/developer devices
|
|
57
66
|
val isRooted = hasRootBeerDetected ||
|
|
58
67
|
hasNativeRootDetected ||
|
|
59
68
|
hasDangerousBins ||
|
|
60
|
-
hasRootApps
|
|
61
|
-
hasSystemPropsModified
|
|
69
|
+
hasRootApps
|
|
62
70
|
|
|
63
71
|
return RootDetectionResult(
|
|
64
72
|
isRooted = isRooted,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-device-defense",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Multi-layer device security detection for React Native (root, hook, debugger, emulator detection)",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|