DEV Community

Dipak Panchasara
Dipak Panchasara

Posted on

๐Ÿ” SafetyNet: a full-stack device-security toolkit for iOS, Android, Flutter, and React Native

Jailbreak/root/tamper detection, anti-debugging, and Play Integrity attestation across all four major mobile platforms โ€” one shared design philosophy.
The four pieces:
๐ŸŽ SafetyNet (Swift Package) โ€” jailbreak detection, anti-debugging, code-signature integrity, proxy/VPN detection, secure Keychain storage. Zero third-party dependencies.
๐Ÿค– SafetyNetAndroid (Kotlin) โ€” root/tamper detection, debugger detection, proxy/VPN detection, Play Integrity API.
๐ŸŽฏ SafetyNetFlutter โ€” one Dart API wrapping both native SDKs.
โš›๏ธ SafetyNetReactNative โ€” one JS API via a TurboModule, same coverage.
Some of what's actually under the hood:
โšก 9 independent jailbreak signals on iOS (filesystem, injected dylibs, Frida ports, sandbox breach, URL schemes, suspicious processes, Shadow tweaks, symlinks, open ports) โ€” weighted and scored so no single check alone can trigger a critical lockdown. Multiple independent signals have to agree.
๐Ÿ›ก๏ธ Anti-debugging via a raw ARM64 syscall (ptrace(PT_DENY_ATTACH)) โ€” issued at a level no hookable libc symbol can intercept.
๐ŸŽš๏ธ Selective checks (SafetyNetChecks / RootCheck / DebuggerCheck) โ€” run everything, or cherry-pick exactly the signals you want.
๐Ÿงช Debug-safe by design โ€” every check short-circuits to a safe value under #if DEBUG / BuildConfig.DEBUG, so it never gets in the way of your own dev workflow.
๐Ÿ”‘ A scoped Secure Keychain wrapper isolated from your app's own Keychain usage.
๐Ÿ”„ Proxy/VPN detection now covers Android too โ€” closes the gap between platforms, folded automatically into check() on Flutter and React Native.
The one rule that shapes everything: none of these auto-react. They only report what they find and let the host app decide what to do. No forced logout, no silently disabled UI, no killing the process. That constraint traces back to a real production incident where a library's own auto-reaction silently broke a login screen โ€” "report only" is the whole point.
Play Integrity API support ships across Android, Flutter, and React Native too โ€” request an attestation token from Google, verify it server-side, layer it on top of the on-device checks.
Get it:
๐Ÿ“ฆ iOS โ€” Swift Package Manager: https://lnkd.in/dVD4AgxH (or CocoaPods via a git-based Podfile line โ€” not yet on the CocoaPods trunk)
๐Ÿ“ฆ Android โ€” Maven Central: https://lnkd.in/d8QrWFUQ (1.1.0)
๐Ÿ“ฆ Flutter โ€” pub.dev: https://lnkd.in/dTeYWG9t (1.2.0)
๐Ÿ“ฆ React Native โ€” npm: https://lnkd.in/dihRvhax (0.3.0)
Repos:
๐Ÿ”— https://lnkd.in/dVD4AgxH
๐Ÿ”— https://lnkd.in/dggRHj8Q
๐Ÿ”— https://lnkd.in/djAQQtpk
๐Ÿ”— https://lnkd.in/dRmzpVP4

mobiledev #iOS #Android #Flutter #ReactNative #AppSecurity #OpenSource

Top comments (0)