Security Rules

Complete reference of all 68+ security rules across 13 categories that rnsec checks for.

Overview: 68+ Rules Across 13 Categories

Storage Security5

AsyncStorage, hardcoded secrets, PII

Network Security2

HTTP usage, SSL/TLS, timeouts

WebView Security11

WebView security configurations

Authentication & Authorization7

JWT, tokens, passwords, biometric

Cryptography2

Weak algorithms, hardcoded keys

Logging2

Sensitive data in logs and errors

React Native Specific8

Bridge security, deep links, integrity

API Keys & Secrets Detection2

API keys (27+ patterns)

Debug & Development Artifacts5

Test credentials, debug endpoints

Android Security9

Manifest, Keystore, permissions

iOS Security8

Info.plist, ATS, Keychain

Configuration2

Dangerous permissions

Manifest2

App configuration issues

Third-Party & SDKs3

Third-party SDK risks

Storage Security 5 rules

AsyncStorage Sensitive Data

HIGH
ASYNCSTORAGE_SENSITIVE_KEY

Detects sensitive data stored in AsyncStorage (tokens, passwords, credentials). AsyncStorage stores data in plaintext and is accessible to all apps with root access.

Fix: Use expo-secure-store or react-native-keychain for sensitive data.

Hardcoded Secrets

HIGH
HARDCODED_SECRETS

Identifies hardcoded API keys, JWT tokens, AWS credentials, and secrets in source code. These can be extracted from app bundles.

Fix: Use environment variables or secure configuration management.

PII in AsyncStorage

HIGH
ASYNCSTORAGE_PII_DATA

AsyncStorage storing PII (email, phone, SSN, credit card) without encryption. Required for GDPR/CCPA compliance.

Fix: Encrypt PII data or use secure storage solutions.

Unencrypted Redux Persist

MEDIUM
REDUX_PERSIST_NO_ENCRYPTION

Redux persist configuration without encryption transform for sensitive data.

Fix: Use redux-persist-transform-encrypt for sensitive state.

Clipboard Sensitive Data

MEDIUM
CLIPBOARD_SENSITIVE_DATA

Sensitive data copied to clipboard (accessible by other apps).

Fix: Avoid copying sensitive data; clear clipboard after timeout.

Network Security 2 rules

HTTP URL in WebView

MEDIUM
INSECURE_HTTP_URL

WebView loading HTTP URLs instead of HTTPS.

Fix: Use HTTPS URLs for all external resources.

No Request Timeout

MEDIUM
NO_REQUEST_TIMEOUT

Network requests without timeout configuration. Can lead to resource exhaustion and denial of service if requests hang indefinitely.

Fix: Set reasonable timeout values for all network requests (e.g., 30 seconds for API calls).

Weak TLS Configuration

MEDIUM
WEAK_TLS_CONFIGURATION

TLS version less than 1.2 or custom httpsAgent with insecure options. Weak TLS configurations are vulnerable to protocol downgrade attacks.

Fix: Require minimum TLS 1.2, use secure cipher suites, avoid custom insecure configurations.

WebView Security 11 rules

Insecure WebView Configuration

HIGH
INSECURE_WEBVIEW

WebView with dangerous default configurations that can enable XSS and code injection.

Fix: Disable JavaScript if not needed, validate all loaded URLs.

JavaScript Injection Risk

HIGH
WEBVIEW_JAVASCRIPT_INJECTION

WebView with JavaScript enabled loading dynamic or user-controlled content.

Fix: Sanitize content, validate origins, disable JavaScript for untrusted content.

File Access Enabled

HIGH
WEBVIEW_FILE_ACCESS

WebView with file access enabled - allows access to local files.

Fix: Disable allowFileAccess unless absolutely required.

Unvalidated Navigation

HIGH
WEBVIEW_UNVALIDATED_NAVIGATION

WebView without URL validation on navigation - potential open redirect.

Fix: Validate URLs in onShouldStartLoadWithRequest before allowing navigation.

PostMessage No Origin Check

HIGH
WEBVIEW_POSTMESSAGE_NO_ORIGIN_CHECK

WebView onMessage handler without origin validation.

Fix: Verify event.nativeEvent.url origin before processing messages.

DOM Storage Enabled

MEDIUM
WEBVIEW_DOM_STORAGE_ENABLED

WebView with DOM storage enabled - may expose sensitive data.

Fix: Disable DOM storage if not required.

Geolocation Enabled

MEDIUM
WEBVIEW_GEOLOCATION_ENABLED

WebView with geolocation enabled - requires proper permission handling.

Fix: Only enable if necessary, implement permission checks.

Mixed Content Allowed

MEDIUM
WEBVIEW_MIXED_CONTENT

WebView allows mixed content - HTTPS pages can load HTTP resources.

Fix: Set mixedContentMode to never.

Caching Enabled

LOW
WEBVIEW_CACHING_ENABLED

WebView with caching enabled - may cache sensitive content.

Fix: Disable caching for sensitive data.

JavaScript Bridge Without Validation

HIGH
JAVASCRIPT_ENABLED_BRIDGE

Native module calls without input validation.

Fix: Validate all inputs from JavaScript bridge calls.

Missing Security Headers

LOW
MISSING_SECURITY_HEADERS

WebView loading content without proper security headers like Content-Security-Policy (CSP) or X-Frame-Options. Missing headers can enable XSS and clickjacking attacks.

Fix: Implement CSP headers, X-Frame-Options, and other security headers on served content.

Authentication & Authorization 7 rules

Insecure Random

HIGH
INSECURE_RANDOM

Math.random() used for security-sensitive operations (tokens, session IDs, encryption keys, OTP codes). Only flagged when used in security contexts - general use like Math.random() * 100 is ignored.

Fix: Use crypto.randomBytes() or expo-crypto for secure random generation.

OAuth Token in URL

HIGH
OAUTH_TOKEN_IN_URL

OAuth/access token passed in URL query parameters - logged in browser history.

Fix: Use POST requests or Authorization headers for tokens.

Certificate Pinning Disabled

MEDIUM
CERT_PINNING_DISABLED

SSL certificate pinning not implemented. While this is a recommended hardening measure against MITM attacks, many legitimate apps operate securely without it. Consider implementing for high-security applications.

Fix: Implement certificate pinning for production environments handling sensitive data.

No JWT Expiry Check

MEDIUM
JWT_NO_EXPIRY_CHECK

JWT token retrieved from storage without expiration validation.

Fix: Validate exp claim before using JWT tokens.

Insecure Password Input

MEDIUM
TEXT_INPUT_NO_SECURE

Password or sensitive input field without secureTextEntry property.

Fix: Set secureTextEntry={true} for password inputs.

Improper Biometric Fallback

MEDIUM
IMPROPER_BIOMETRIC_FALLBACK

Biometric authentication falling back to insecure methods like PIN stored in JavaScript or plaintext password. Fallback mechanisms should be as secure as the primary authentication method.

Fix: Implement secure fallback mechanisms using system-level authentication or encrypted storage.

Root/Jailbreak Detection Absent

HIGH
ROOT_JAILBREAK_DETECTION_ABSENT

No root/jailbreak detection for sensitive apps (banking, fintech, healthcare). Rooted/jailbroken devices can bypass security controls and expose sensitive data.

Fix: Implement root/jailbreak detection checks and handle accordingly (warn users or restrict functionality).

Cryptography 2 rules

Weak Cryptographic Algorithm

HIGH
WEAK_CRYPTO_ALGORITHM

Use of weak crypto algorithms like MD5, SHA1, DES, or RC4.

Fix: Use AES-256-GCM, SHA-256, or stronger algorithms.

Hardcoded Encryption Key

HIGH
HARDCODED_ENCRYPTION_KEY

Encryption keys hardcoded in source code.

Fix: Generate keys at runtime or retrieve from secure storage.

Logging 2 rules

Network Logger in Production

MEDIUM
NETWORK_LOGGER_IN_PRODUCTION

Network request/response logging enabled (Axios interceptors, fetch logging). Logs may contain auth tokens, API keys, and sensitive request data.

Fix: Disable network logging in production builds.

Sensitive Data in Error Messages

MEDIUM
SENSITIVE_DATA_IN_ERROR_MESSAGES

Backend error responses surfaced directly to UI or stack traces shown in production. Error messages can expose internal system details, credentials, or sensitive data paths.

Fix: Sanitize error messages in production, log detailed errors server-side only.

React Native Specific 8 rules

Debugger Enabled in Production

MEDIUM
DEBUGGER_ENABLED_PRODUCTION

Debugger statements or __DEV__ checks in production code. Debug code exposes internal state and can bypass security checks.

Fix: Remove debugger statements and wrap debug code in __DEV__ blocks.

Insecure Deeplink Handler

HIGH
INSECURE_DEEPLINK_HANDLER

Deep link handlers without proper URL validation. Malicious apps can trigger arbitrary deep links to execute unauthorized actions.

Fix: Validate URL schemes, hostnames, and parameters before processing.

Screenshot Protection Missing

MEDIUM
SCREENSHOT_PROTECTION_MISSING

Sensitive screens without screenshot/screen recording protection. Screenshots can expose sensitive data in photo galleries and backups.

Fix: Use expo-screen-capture or native view flags to prevent screenshots.

Unsafe dangerouslySetInnerHTML

HIGH
UNSAFE_DANGEROUSLY_SET_INNER_HTML

dangerouslySetInnerHTML used with potentially unsafe content. Enables XSS attacks if user input is rendered as HTML.

Fix: Sanitize HTML or use safe rendering methods.

Eval Usage

HIGH
EVAL_USAGE

eval() or Function constructor used - code injection risk. Allows arbitrary code execution.

Fix: Never use eval(). Parse JSON safely with JSON.parse().

Console Log Sensitive Data

LOW
CONSOLE_LOG_SENSITIVE

console.log() statements logging sensitive data.

Fix: Remove console.log in production or use proper logging libraries.

Navigation State Contains Sensitive Data

MEDIUM
NAVIGATION_STATE_SENSITIVE

Sensitive data passed in navigation params or state.

Fix: Pass only IDs, fetch sensitive data in destination screen.

Missing Runtime Integrity Checks

HIGH
MISSING_RUNTIME_INTEGRITY_CHECKS

No tamper detection, checksum/signature verification, or integrity APIs (Play Integrity API, App Attest). Apps without integrity checks are vulnerable to modification and reverse engineering.

Fix: Implement Play Integrity API (Android) or App Attest (iOS), add checksum validation for critical code.

API Keys & Secrets Detection 2 rules

API Key Exposed

HIGH
API_KEY_EXPOSED

Detects 27+ types of exposed API keys and secrets including Firebase, AWS, Stripe, GitHub tokens, RSA keys, JWT tokens, and more. Exposed API keys lead to unauthorized access, data breaches, and financial loss.

Fix: Move all secrets to environment variables, use secret management services, never commit .env files.

Environment File Committed

HIGH
ENV_FILE_COMMITTED

Environment file (.env) with secrets potentially committed to repository. .env files contain production secrets and should never be in version control.

Fix: Add .env to .gitignore, use .env.example with placeholders, remove from git history.

Debug & Development Artifacts 5 rules

Test Credentials in Code

MEDIUM
TEST_CREDENTIALS_IN_CODE

Test credentials or example passwords found in source code (test@test.com, admin/admin, demo passwords). Test credentials often work in production or reveal credential format.

Fix: Remove all test credentials, use mocked authentication in tests.

Debug Endpoints Exposed

MEDIUM
DEBUG_ENDPOINTS_EXPOSED

Debug or development endpoints exposed in production code (/debug, /dev, /test, /admin). Debug endpoints bypass authentication and expose internal functionality.

Fix: Remove debug endpoints or protect with authentication.

Redux DevTools Enabled

MEDIUM
REDUX_DEVTOOLS_ENABLED

Redux DevTools enabled in production. Exposes entire application state including sensitive data.

Fix: Disable Redux DevTools in production builds.

Storybook in Production

LOW
STORYBOOK_IN_PRODUCTION

Storybook imports detected in production code. Increases bundle size and may expose component internals.

Fix: Remove Storybook imports from production builds.

Source Map Reference

LOW
SOURCEMAP_REFERENCE

Source map reference in production bundle. Source maps reveal original source code including comments and logic.

Fix: Disable source maps in production or host them securely.

Android Security 9 rules

Cleartext Traffic Enabled

HIGH
ANDROID_CLEARTEXT_ENABLED

android:usesCleartextTraffic="true" in AndroidManifest.xml - allows unencrypted HTTP.

Fix: Set to false or remove (defaults to false on API 28+).

Debuggable in Production

HIGH
ANDROID_DEBUGGABLE_ENABLED

android:debuggable="true" in production manifest - allows debuggers to attach.

Fix: Remove debuggable flag from production builds.

Exported Component Unprotected

HIGH
ANDROID_EXPORTED_COMPONENT

Exported Android component without permission protection - other apps can access.

Fix: Add permission requirements or set android:exported="false".

Unprotected Receiver

HIGH
ANDROID_UNPROTECTED_RECEIVER

Broadcast receiver without permission protection - any app can send broadcasts.

Fix: Require permission or use local broadcasts.

Backup Allowed

MEDIUM
ANDROID_BACKUP_ALLOWED

android:allowBackup="true" - app data included in cloud backups.

Fix: Set to false for apps handling sensitive data.

Permissive Intent Filter

MEDIUM
ANDROID_INTENT_FILTER_PERMISSIVE

Overly permissive intent filter may expose unintended functionality.

Fix: Restrict intent filters to specific actions and data types.

Insecure Android Keystore Usage

HIGH
INSECURE_KEYSTORE_USAGE

Android Keystore configuration without StrongBox, user authentication, or using weak block modes like ECB. Insecure Keystore usage weakens encryption and key protection.

Fix: Use StrongBox when available, require user authentication, use secure block modes (GCM/CBC).

Insecure File Storage

MEDIUM
INSECURE_FILE_STORAGE

Files written to external storage, shared directories, or without encryption. Externally stored files are accessible to other apps and users.

Fix: Use internal storage, encrypt sensitive files, set proper file permissions.

Excessive Permissions

LOW
EXCESSIVE_PERMISSIONS

Android permissions declared but not used in code. Unnecessary permissions raise privacy concerns and user distrust.

Fix: Remove unused permissions from AndroidManifest.xml.

iOS Security 8 rules

ATS Disabled

HIGH
IOS_ATS_DISABLED

App Transport Security disabled via NSAllowsArbitraryLoads - allows insecure HTTP.

Fix: Remove NSAllowsArbitraryLoads or use specific domain exceptions.

Permissive ATS Exception

HIGH
IOS_ATS_EXCEPTION_TOO_PERMISSIVE

ATS exception allows insecure loads for entire domains unnecessarily.

Fix: Use specific exceptions, require minimum TLS version.

Missing Usage Descriptions

MEDIUM
IOS_USAGE_DESCRIPTIONS_MISSING

Missing usage descriptions for privacy-sensitive permissions (Camera, Location, etc).

Fix: Add NS*UsageDescription keys to Info.plist.

Unnecessary Background Modes

MEDIUM
IOS_BACKGROUND_MODES_UNNECESSARY

Potentially unnecessary background modes enabled - privacy concerns.

Fix: Only enable required background modes.

Universal Links Misconfigured

MEDIUM
IOS_UNIVERSAL_LINKS_MISCONFIGURED

Universal links configured without proper validation.

Fix: Validate domains and implement proper URL handling.

Unprotected URL Scheme

MEDIUM
IOS_CUSTOM_URL_SCHEME_UNPROTECTED

Custom URL scheme without validation code - any app can open.

Fix: Validate URL parameters and implement security checks.

Insecure Keychain Access

MEDIUM
IOS_KEYCHAIN_ACCESS_GROUP_INSECURE

Keychain access group configuration may expose data to other apps.

Fix: Use app-specific keychain access groups.

Insecure iOS Keychain Usage

HIGH
INSECURE_KEYCHAIN_USAGE

Keychain items using kSecAttrAccessibleAlways, missing kSecAttrAccessControl, or no biometric/passcode protection. Always-accessible keychain items can be extracted without user authentication.

Fix: Use kSecAttrAccessibleWhenUnlockedThisDeviceOnly, require biometric or passcode protection with kSecAttrAccessControl.

Configuration 2 rules

Expo Insecure Permissions

LOW
EXPO_INSECURE_PERMISSIONS

Potentially dangerous permissions in app.json. Overreaching permissions raise privacy concerns.

Fix: Only request essential permissions for core functionality.

Insecure Deserialization

LOW
INSECURE_DESERIALIZATION

JSON.parse on untrusted input, eval-like dynamic object construction, or native deserialization without validation. Can lead to code execution or prototype pollution attacks.

Fix: Validate and sanitize all input before deserialization, use safe parsing libraries, implement schema validation.

Manifest 2 rules

Excessive Manifest Permissions

LOW
MANIFEST_PERMISSIONS_EXCESSIVE

App requests more permissions than necessary. Privacy concern, users may decline installation.

Fix: Only request permissions that are essential for core functionality.

Third-Party SDK Risk

LOW
THIRD_PARTY_SDK_RISK

Known risky SDKs detected such as session replay tools or ad SDKs in sensitive apps. Some SDKs collect excessive data or introduce security vulnerabilities.

Fix: Review SDK permissions and data collection practices, consider alternatives for sensitive applications.

View All Rules via CLI

List all 68+ available security rules with the command:

rnsec rules
© 2025 rnsec • Open source security