๐Ÿš€ 8.9 Released! โ†’ โšก๏ธ New Node-API Engine Preview, ๐Ÿ“ฒ ns widget ios, ๐Ÿ’… Tailwind v4 and more...
Read Announcement

View on GitHub

@nativescript/ios-security โ€‹

Contents โ€‹

Intro โ€‹

๐Ÿ”’ IOSSecuritySuite for NativeScript.

๐ŸŒ iOS Security Suite is an advanced and easy-to-use platform security & anti-tampering library. If you are developing for iOS and you want to protect your app according to the OWASP MASVS standard, chapter v8, then this library could save you a lot of time. ๐Ÿš€ What ISS detects:

  • Jailbreak (even the iOS 11+ with brand new indicators! ๐Ÿ”ฅ)
  • Attached debugger ๐Ÿ‘จ๐Ÿปโ€๐Ÿš€
  • If an app was run in an emulator ๐Ÿ‘ฝ
  • Common reverse engineering tools running on the device ๐Ÿ”ญ

Installation โ€‹

To install the plugin, run the following command in your app's root folder:

cli
npm install @nativescript/ios-security

Prerequisites โ€‹

Specify the URLs to be queried โ€‹

In the jailbreak detection module, there is a check that uses the canOpenURL(_๐Ÿ˜ƒ method and it requires specifying the URLs that will be queried.

Specify those URLs in the App_Resources/iOS/Info.plist file as follows:

xml
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>cydia</string>
    <string>undecimus</string>
    <string>sileo</string>
    <string>zbra</string>
    <string>filza</string>
    <string>activator</string>
</array>

Use @nativescript/ios-security โ€‹

The following sections describe how to use @nativescript/ios-security.

Detect jailbreaking โ€‹

For a simple check of whether the device is jailbroken, use the amIJailbroken() method.

ts
const isJailBroken: boolean = IOSSecurity.amIJailbroken()
if (isJailBroken) {
  console.log('This device is jailbroken')
} else {
  console.log('This device is not jailbroken')
}

Detect bebugger attachment โ€‹

To detect if a debugger is attached to the app, use the amIDebugged() method.

ts
const amIDebugged: boolean = IOSSecurity.amIDebugged()

Prevent debugger attachment โ€‹

To prevent the debugger from being attached to the app, call the denyDebugger() method.

ts
IOSSecurity.denyDebugger()

Emulator detection โ€‹

To detect if the app is being run on an emulator, call the amIRunInEmulator() method.

ts
const runInEmulator: boolean = IOSSecurity.amIRunInEmulator()

Detect the use of reverse engineering tools โ€‹

To detect if a common reverse engineering tool is being used on the app, call the amIReverseEngineered() method.

ts
const amIReverseEngineered: boolean = IOSSecurity.amIReverseEngineered()

System proxy detection โ€‹

To detect if the user is using a proxy, call the amIProxied() method.

ts
const amIProxied: boolean = IOSSecurity.amIProxied()

Runtime Hooks Detection โ€‹

To detect if a hook is placed in the application's code, call the amIRuntimeHookedWithDyldWhiteListDetectionClassSelectorIsClassMethod() method.

ts
let amIRuntimeHooked: boolean = IOSSecurity.amIRuntimeHookedWithDyldWhiteListDetectionClassSelectorIsClassMethod(dyldWhiteList: NSArray<string> | string[], detectionClass: typeof NSObject, selector: string, isClassMethod: boolean)

App tampering detection โ€‹

To detect if an app has been tampered with, call the amITampered() method.

ts
let amITampered: NSArray<any> =  IOSSecurity.amITampered(checks: NSArray<any> | any[])

License โ€‹

Apache License Version 2.0