This document outlines the security measures implemented in the Fact Pulse application.
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
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
- Environment Variable Loading: All API keys loaded from
.env
file at runtime - Cross-platform Compatibility: Uses Flutter's
rootBundle
for web compatibility - Error Handling: App throws clear errors if required keys are missing
- No Hardcoded Secrets: All hardcoded credentials removed from source code
- Client vs Server Keys:
- β
Client-safe Firebase API keys remain in
firebase_options.dart
- β Sensitive OAuth secrets moved to environment variables
- β
Client-safe Firebase API keys remain in
- Security Rules: Firebase access controlled by server-side security rules
- Configuration Separation: Config files with secrets separated from public config
- Client ID Protection: Google OAuth client IDs secured in environment variables
- Platform-specific Setup: Each platform has its own OAuth configuration
- URL Scheme Security: Proper URL schemes configured for OAuth callbacks
./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
# 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)
- 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
- Never commit
.env
files or Firebase config files to version control - Always validate that sensitive files are in
.gitignore
before committing - Use the setup script (
./setup_templates.sh
) for consistent environment setup - Keep credentials private - never share API keys in public channels
- Rotate credentials if they may have been compromised
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