agentleFS
kgrizz-gitkgrizz-git/AgentsConfigHelper/.cursor/rules/codeguard-0-mobile-apps.mdc

AgentsConfigHelper / rules

Cursor rule2 starsChanged 3 months agoMITView on GitHub

Mobile app security (iOS/Android): storage, transport, code integrity, biometrics, permissions

We split this codeguard-0-mobile-apps.mdc into the rules it gives an agent

28 rules. About 0 are common, 28 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈28

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow least privilege and defense in depth principles

    line 16
  2. Distinctive:

    Use standard secure authentication protocols (OAuth2, JWT)

    line 17
  3. Distinctive:

    Use only trusted and validated third-party libraries and components

    line 21
  4. Distinctive:

    Never trust the client for security decisions:

    line 25
  5. Distinctive:

    Do not store user passwords on device.

    line 27
  6. Distinctive:

    Avoid hardcoding credentials in the mobile app

    line 28
  7. Distinctive:

    Use platform-specific secure storage (iOS Keychain, Android Keystore)

    line 30
  8. Distinctive:

    Use platform-supported biometric authentication with secure fallbacks

    line 34
  9. Distinctive:

    Avoid caching, logging, or background snapshots of sensitive data

    line 43
  10. Distinctive:

    Always use HTTPS for network communications

    line 44
  11. Distinctive:

    Use HTTPS for all network communication

    line 49
  12. Distinctive:

    Do not override SSL certificate validation for self-signed certificates

    line 50
  13. Distinctive:

    Use strong, industry standard cipher suites with appropriate key lengths

    line 51
  14. Distinctive:

    Use certificates signed by trusted CA providers

    line 52
  15. Distinctive:

    Consider certificate pinning for additional security

    line 53
  16. Distinctive:

    Avoid sending sensitive data via SMS

    line 55
  17. Distinctive:

    Use static analysis tools to identify vulnerabilities

    line 60
  18. Distinctive:

    Keep all libraries up to date to patch known vulnerabilities

    line 62
  19. Distinctive:

    Check for debugging, hooking, or code injection

    line 67
  20. Distinctive:

    Verify app signatures at runtime

    line 69
  21. Distinctive:

    Use Android's ProGuard for code obfuscation

    line 74
  22. Distinctive:

    Avoid storing sensitive data in SharedPreferences

    line 75
  23. Distinctive:

    Use Android Keystore with hardware backing (TEE or StrongBox)

    line 77
  24. Distinctive:

    Use conditional logic to mask sensitive widget content on lock screen

    line 84
  25. Distinctive:

    Use Secure Enclave for cryptographic key storage

    line 86
  26. Distinctive:

    Use DeviceCheck API for persistent device state tracking

    line 88
  27. Distinctive:

    Ensure security features do not harm usability

    line 95
  28. Distinctive:

    Use real-time monitoring to detect and respond to threats

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
codeguard-0-mobile-apps.mdc
---
description: 'Mobile app security (iOS/Android): storage, transport, code integrity, biometrics, permissions'
globs: **/*.java,**/*.js,**/*.jsx,**/*.kt,**/*.kts,**/*.m,**/*.mjs,**/*.pl,**/*.pm,**/*.swift,**/*.wsdl,**/*.xml,**/*.xsd,**/*.xslt
version: 1.0.1
---

rule_id: codeguard-0-mobile-apps

## Mobile Application Security Guidelines

Essential security practices for developing secure mobile applications across iOS and Android platforms.

### Architecture and Design

Implement secure design principles from the start:
- Follow least privilege and defense in depth principles
- Use standard secure authentication protocols (OAuth2, JWT)
- Perform all authentication and authorization checks server-side
- Request only necessary permissions for app and backend services
- Establish security controls for app updates, patches, and releases
- Use only trusted and validated third-party libraries and components

### Authentication and Authorization

Never trust the client for security decisions:
- Perform authentication/authorization server-side only
- Do not store user passwords on device; use revocable access tokens
- Avoid hardcoding credentials in the mobile app
- Encrypt credentials in transmission
- Use platform-specific secure storage (iOS Keychain, Android Keystore)
- Require password complexity and avoid short PINs (4 digits)
- Implement session timeouts and remote logout functionality
- Require re-authentication for sensitive operations
- Use platform-supported biometric authentication with secure fallbacks

### Data Storage and Privacy

Protect sensitive data at rest and in transit:
- Encrypt sensitive data using platform APIs; avoid custom encryption
- Leverage hardware-based security features (Secure Enclave, Strongbox)
- Store private data on device's internal storage only
- Minimize PII collection to necessity and implement automatic expiration
- Avoid caching, logging, or background snapshots of sensitive data
- Always use HTTPS for network communications

### Network Communication

Assume all network communication is insecure:
- Use HTTPS for all network communication
- Do not override SSL certificate validation for self-signed certificates
- Use strong, industry standard cipher suites with appropriate key lengths
- Use certificates signed by trusted CA providers
- Consider certificate pinning for additional security
- Encrypt data even if sent over SSL
- Avoid sending sensitive data via SMS

### Code Quality and Integrity

Maintain application security throughout development:
- Use static analysis tools to identify vulnerabilities
- Make security a focal point during code reviews
- Keep all libraries up to date to patch known vulnerabilities
- Disable debugging in production builds
- Include code to validate integrity of application code
- Obfuscate the app binary
- Implement runtime anti-tampering controls:
  - Check for debugging, hooking, or code injection
  - Detect emulator or rooted/jailbroken devices
  - Verify app signatures at runtime

### Platform-Specific Security

#### Android Security
- Use Android's ProGuard for code obfuscation
- Avoid storing sensitive data in SharedPreferences
- Disable backup mode to prevent sensitive data in backups
- Use Android Keystore with hardware backing (TEE or StrongBox)
- Implement Google's Play Integrity API for device and app integrity checks

#### iOS Security
- Configure Shortcuts permissions to require device unlock for sensitive actions
- Set Siri intent `requiresUserAuthentication` to true for sensitive functionality
- Implement authentication checks on deep link endpoints
- Use conditional logic to mask sensitive widget content on lock screen
- Store sensitive data in iOS Keychain, not plist files
- Use Secure Enclave for cryptographic key storage
- Implement App Attest API for app integrity validation
- Use DeviceCheck API for persistent device state tracking

### Testing and Monitoring

Validate security controls through comprehensive testing:
- Perform penetration testing including cryptographic vulnerability assessment
- Leverage automated tests to ensure security features work as expected
- Ensure security features do not harm usability
- Use real-time monitoring to detect and respond to threats
- Have a clear incident response plan in place
- Plan for regular updates and implement forced update mechanisms when necessary

### Input and Output Validation

Prevent injection and execution attacks:
- Validate and sanitize all user input
- Validate and sanitize output to prevent injection attacks
- Mask sensitive information on UI fields to prevent shoulder surfing
- Inform users about security-related activities (logins from new devices)

By following these practices derived from the OWASP Mobile Application Security framework, you can significantly improve the security posture of your mobile applications across both development and operational phases.

Download now (ZIP)

Trending

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Aug 30: 0 new projectsWeek of Sep 6: 0 new projectsWeek of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projects
Aug 2026Sep 2026Oct 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.