Skip to content

Security: vishnu32510/fact_pulse

Security

SECURITY.md

Security Documentation

This document outlines the security measures implemented in the Fact Pulse application.

πŸ”’ Secured Credentials

Environment Variables (.env)

All sensitive API keys and credentials are stored in environment variables:

  • βœ… Perplexity API Key - AI fact-checking service
  • βœ… Google OAuth Client IDs - For Google Sign-in authentication
  • βœ… Firebase Project Configuration - Project ID and messaging sender ID

Platform Configuration Files

Sensitive configuration files are not committed to version control:

  • βœ… android/app/google-services.json - Android Firebase config
  • βœ… ios/Runner/GoogleService-Info.plist - iOS Firebase config
  • βœ… macos/Runner/GoogleService-Info.plist - macOS Firebase config
  • βœ… ios/Runner/Info.plist - iOS OAuth client configuration
  • βœ… macos/Runner/Info.plist - macOS OAuth client configuration
  • βœ… web/index.html - Web OAuth client configuration

πŸ›‘οΈ Security Best Practices

API Key Management

  1. Environment Variable Loading: All API keys loaded from .env file at runtime
  2. Cross-platform Compatibility: Uses Flutter's rootBundle for web compatibility
  3. Error Handling: App throws clear errors if required keys are missing
  4. No Hardcoded Secrets: All hardcoded credentials removed from source code

Firebase Security

  1. Client vs Server Keys:
    • βœ… Client-safe Firebase API keys remain in firebase_options.dart
    • ❌ Sensitive OAuth secrets moved to environment variables
  2. Security Rules: Firebase access controlled by server-side security rules
  3. Configuration Separation: Config files with secrets separated from public config

OAuth Security

  1. Client ID Protection: Google OAuth client IDs secured in environment variables
  2. Platform-specific Setup: Each platform has its own OAuth configuration
  3. URL Scheme Security: Proper URL schemes configured for OAuth callbacks

πŸ”§ Developer Setup

Automated Setup

./setup_templates.sh

This script:

  • Copies template files to correct locations
  • Injects OAuth client IDs from .env file
  • Sets up proper URL schemes automatically
  • Validates configuration

Manual Verification

# Check that sensitive files are not tracked
git status --porcelain | grep -E "(\.env|google-services|GoogleService-Info|Info\.plist|index\.html)$"

# Should return empty (no results)

πŸ“‹ Security Checklist

  • All API keys moved to environment variables
  • Sensitive config files added to .gitignore
  • Template files created for developers
  • Automated setup script provided
  • Documentation updated with security practices
  • Cross-platform compatibility maintained
  • Error handling for missing credentials
  • OAuth client IDs properly secured

⚠️ Important Notes

  1. Never commit .env files or Firebase config files to version control
  2. Always validate that sensitive files are in .gitignore before committing
  3. Use the setup script (./setup_templates.sh) for consistent environment setup
  4. Keep credentials private - never share API keys in public channels
  5. Rotate credentials if they may have been compromised

πŸ” Security Audit

Last security review: $(date)

  • All hardcoded credentials removed βœ…
  • Environment variable system implemented βœ…
  • Cross-platform compatibility verified βœ…
  • Developer documentation complete βœ…

For setup instructions, see FIREBASE_SETUP.md

There aren’t any published security advisories