Skip to content

Security: rudi-q/pinkrain_health_journal

Security

SECURITY.md

πŸ›‘οΈ Security Policy

Overview

PinkRain is a privacy-first mental health and wellness tracking application built with security at its core. This document outlines our security policies, practices, and procedures for reporting security vulnerabilities.

Core Security Principle: All user data remains on-device and is never transmitted or collected by external services.

πŸ“‹ Table of Contents

πŸ—οΈ Security Architecture

Privacy-First Design

PinkRain implements a zero-trust, local-first architecture:

  • No Data Collection: We never collect, store, or transmit user data
  • Local Storage Only: All data is stored locally using encrypted Hive database
  • No Cloud Sync: Data never leaves the user's device
  • No Analytics: No user behavior tracking or telemetry
  • Open Source: Full transparency through open-source code

Core Security Principles

  1. Data Minimization: Only collect data necessary for app functionality
  2. Local Encryption: Sensitive data is encrypted at rest
  3. No Network Transmission: Personal data never leaves the device
  4. Secure Dependencies: Regular security audits of third-party packages
  5. Transparent Code: All security implementations are open source

πŸ”’ Data Protection

Local Data Security

  • Encryption at Rest: Sensitive user data is encrypted using AES-256
  • Secure Key Management: Encryption keys are generated and stored securely on-device
  • Data Isolation: App data is sandboxed within the application container
  • Secure Deletion: Proper data wiping when users delete information

Data Categories

Data Type Storage Method Encryption Transmission
Mood Entries Local Hive DB βœ… Encrypted ❌ Never transmitted
Medication Data Local Hive DB βœ… Encrypted ❌ Never transmitted
Audio Preferences Local Storage βœ… Encrypted ❌ Never transmitted
User Settings Local Storage βœ… Encrypted ❌ Never transmitted
ML Model Data Local Assets βœ… Encrypted ❌ Never transmitted

Data Retention

  • User Control: Users can delete their data at any time
  • No Backup: We don't create external backups of user data
  • App Uninstall: All data is removed when the app is uninstalled
  • Data Export: Users can export their data in encrypted formats

πŸ“± Supported Versions

We actively maintain and provide security updates for the following versions:

Version Supported Security Updates
2.1.x βœ… Yes Until 2025-12-31
2.0.x βœ… Yes Until 2025-06-30
1.x.x ❌ No End of Life

Update Policy

  • Security Updates: Released within 48 hours for critical vulnerabilities
  • Regular Updates: Monthly security reviews and updates
  • End-of-Life: 12-month support window for major versions

🚨 Reporting Security Vulnerabilities

Responsible Disclosure

We encourage responsible disclosure of security vulnerabilities. Please follow these guidelines:

How to Report

Email: [email protected] (preferred) Subject: [SECURITY] PinkRain App Vulnerability Report

What to Include

Please provide the following information:

  1. Vulnerability Description: Clear description of the security issue
  2. Steps to Reproduce: Detailed steps to reproduce the vulnerability
  3. Impact Assessment: Potential impact and affected users
  4. Proof of Concept: Code, screenshots, or logs (if applicable)
  5. Suggested Fix: Recommendations for addressing the issue (optional)
  6. Contact Information: How we can reach you for follow-up

Response Timeline

  • Initial Response: Within 24 hours of receiving the report
  • Vulnerability Assessment: Within 72 hours
  • Fix Development: 1-7 days (depending on severity)
  • Release: Within 48 hours for critical issues
  • Public Disclosure: 30 days after fix is released (coordinated disclosure)

Severity Levels

Severity Response Time Definition
Critical 24 hours Remote code execution, data breach
High 48 hours Privilege escalation, data exposure
Medium 1 week Information disclosure, DoS
Low 2 weeks Minor security improvements

Recognition

We believe in recognizing security researchers who help make PinkRain more secure:

  • Hall of Fame: Recognition in our security acknowledgments
  • Credit: Public credit in release notes (with permission)
  • Communication: Direct communication channel with development team

πŸ” Security Best Practices

For Users

  • Keep Updated: Always use the latest version of PinkRain
  • Device Security: Use device lock screens and biometric authentication
  • App Permissions: Review and understand requested permissions
  • Regular Backups: Export your data regularly for personal backups
  • Suspicious Activity: Report any unusual app behavior

For Developers

  • Secure Coding: Follow OWASP Mobile Security guidelines
  • Input Validation: Validate all user inputs and data
  • Dependency Updates: Keep all dependencies up to date
  • Security Testing: Run security tests before releases
  • Code Review: All security-related code must be peer-reviewed

🎯 Threat Model

Threats We Protect Against

  1. Data Interception: Network-based attacks on user data
  2. Local Data Access: Unauthorized access to on-device data
  3. Malicious Dependencies: Compromised third-party packages
  4. Code Injection: Attempts to inject malicious code
  5. Privacy Violations: Unauthorized data collection or tracking

Attack Vectors

Attack Vector Mitigation Risk Level
Network Interception No sensitive data transmission βœ… Low
Device Compromise Local encryption, secure key storage ⚠️ Medium
Malicious Dependencies Regular audits, pinned versions ⚠️ Medium
Social Engineering User education, clear permissions ⚠️ Medium
Physical Device Access Device-level security, app sandboxing πŸ”΄ High

Out of Scope

  • Device-level security: Operating system vulnerabilities
  • Physical device theft: Device encryption and lock screens
  • Social engineering: User education and awareness
  • Network infrastructure: ISP or network provider security

✨ Security Features

Built-in Security

  • Local Encryption: AES-256 encryption for sensitive data
  • Secure Storage: Platform-specific secure storage APIs
  • No Analytics: Zero telemetry or user tracking
  • Minimal Permissions: Only essential permissions requested
  • Sandboxed Execution: App runs in isolated environment

Privacy Features

  • Offline Operation: Full functionality without internet connection
  • No User Accounts: No registration or login required
  • No Cloud Services: All processing happens on-device
  • Transparent Code: Open source for full transparency
  • User Control: Complete control over personal data

Experimental Feature Security

When experimental AI features are enabled:

  • Local ML: TensorFlow Lite models run entirely on-device
  • No Cloud AI: No data sent to external AI services
  • Secure Models: ML models are cryptographically signed
  • Feature Isolation: Experimental features are sandboxed

πŸ“¦ Third-Party Dependencies

Security Auditing

We regularly audit our dependencies for security vulnerabilities:

  • Automated Scanning: Daily dependency vulnerability scans
  • Manual Review: Quarterly manual security reviews
  • Version Pinning: Specific dependency versions to prevent supply chain attacks
  • Minimal Dependencies: Only essential packages are included

Key Dependencies Security Status

Package Purpose Security Level Last Audit
flutter UI Framework βœ… High 2024-08-30
hive Local Database βœ… High 2024-08-30
riverpod State Management βœ… High 2024-08-30
tflite_flutter ML Inference βœ… High 2024-08-30
just_audio Audio Playback βœ… High 2024-08-30

Dependency Management

  • Vulnerability Monitoring: Automated alerts for security issues
  • Update Strategy: Prompt updates for security patches
  • Minimal Surface: Remove unused dependencies
  • Source Verification: Verify package authenticity and integrity

πŸ§ͺ Security Testing

Testing Strategy

  • Static Analysis: Automated code security scanning
  • Dependency Scanning: Regular vulnerability assessments
  • Penetration Testing: Periodic security assessments
  • Code Review: Security-focused peer reviews

Security Test Coverage

  • βœ… Data Encryption: Verify all sensitive data is encrypted
  • βœ… Network Isolation: Ensure no unauthorized network requests
  • βœ… Permission Validation: Verify minimal permission usage
  • βœ… Input Validation: Test all user input handling
  • βœ… Error Handling: Verify secure error handling

Continuous Security

# Security testing commands
flutter analyze --fatal-infos
dart pub deps --json | dart pub global run pana
flutter test test/security/

⚠️ Security Considerations

Medical Data Sensitivity

As a mental health app, PinkRain handles highly sensitive personal information:

  • HIPAA Awareness: While not HIPAA-covered, we follow similar privacy principles
  • Mental Health Privacy: Extra protection for sensitive mental health data
  • No Medical Claims: App disclaimers prevent medical liability
  • Research Context: Data used only for personal tracking and research

Platform-Specific Security

Android

  • App Sandboxing: Android app sandbox provides isolation
  • Keystore Integration: Android Keystore for secure key management
  • Permission Model: Android 6+ runtime permission model
  • App Signing: APK signing with strong cryptographic keys

iOS

  • App Sandbox: iOS app sandbox provides process isolation
  • Keychain Integration: iOS Keychain for secure credential storage
  • App Transport Security: HTTPS enforcement for network requests
  • Code Signing: Strong code signing requirements

Web (Limited Support)

  • Browser Security: Relies on browser security model
  • Local Storage: Encrypted local storage where supported
  • HTTPS Only: All web requests over HTTPS
  • CSP Headers: Content Security Policy headers

πŸ”„ Incident Response

Security Incident Process

  1. Detection: Automated monitoring and user reports
  2. Assessment: Rapid evaluation of impact and scope
  3. Containment: Immediate steps to prevent further impact
  4. Investigation: Thorough analysis of the incident
  5. Remediation: Fix development and deployment
  6. Communication: Transparent user communication
  7. Post-Incident: Lessons learned and process improvements

Emergency Contacts

πŸ“š Security Resources

For Developers

For Users

πŸ“ž Contact Information

Security Team

  • Email: [email protected]
  • PGP Key: Available upon request
  • Response Time: 24 hours for security issues

General Support

  • Email: [email protected]
  • GitHub Issues: For non-security related issues
  • GitHub Discussions: Community support and questions

πŸ”„ Updates and Changelog

This security policy is reviewed and updated regularly:

  • Last Updated: August 30, 2024
  • Version: 1.0
  • Next Review: November 30, 2024

Recent Updates

  • 2024-08-30: Initial security policy creation
  • 2024-08-30: Added threat model and security architecture
  • 2024-08-30: Defined vulnerability disclosure process

πŸ™ Acknowledgments

We thank the security research community for helping make PinkRain more secure:

  • Security researchers who report vulnerabilities responsibly
  • The Flutter and Dart security teams for framework security
  • The open-source security community for tools and guidance

βš–οΈ Legal Notice

This security policy is part of PinkRain's commitment to user privacy and security. By using PinkRain, you acknowledge that:

  • Security is a shared responsibility between users and developers
  • No system is 100% secure, but we strive for best practices
  • Users should follow basic security hygiene on their devices
  • This policy may be updated to reflect new security measures

πŸ›οΈ "Your mental health matters. Your privacy and security matter more." πŸ›οΈ

Made with ❀️ for privacy-first mental health technology

There aren’t any published security advisories