Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# AWS Configuration
AWS_ACCESS_KEY_ID=your_aws_access_key_here
AWS_ACCESS_SECRET_KEY=your_aws_secret_key_here
MWS_AUTH_TOKEN=your_mws_auth_token_here

# Google Configuration
GCP_PRIVATE_KEY_ID=your_gcp_private_key_id_here
GCP_PRIVATE_KEY=your_gcp_private_key_here
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_CAPTCHA_KEY=your_google_captcha_key_here

# Github Configuration
GITHUB_KEY=your_github_key_here
GITHUB_CLIENT_ID=your_github_client_id_here
GITHUB_APP_SECRET=your_github_app_secret_here
GITHUB_OAUTH_CLIENT_ID=your_github_oauth_client_id_here
GITHUB_OAUTH_SECRET=your_github_oauth_secret_here

# Slack Configuration
SLACK_CLIENT_ID=your_slack_client_id_here
SLACK_CLIENT_SECRET=your_slack_client_secret_here
SLACK_SIGNING_SECRET=your_slack_signing_secret_here
SLACK_APP_TOKEN=your_slack_app_token_here
SLACK_OAUTH_ACCESS_TOKEN=your_slack_oauth_access_token_here
SLACK_WEBHOOK=your_slack_webhook_here

# Stripe Configuration
STRIPE_SECRET_KEY=your_stripe_secret_key_here
STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key_here
STRIPE_RESTRICTED_KEY=your_stripe_restricted_key_here

# Facebook Configuration
FACEBOOK_ACCESS_TOKEN=your_facebook_access_token_here

# Square Configuration
SQUARE_ACCESS_TOKEN=your_square_access_token_here
SQUARE_OAUTH_SECRET=your_square_oauth_secret_here

# Paypal Configuration
PAYPAL_BRAINTREE_ACCESS_TOKEN=your_paypal_braintree_access_token_here

# Twilio Configuration
TWILIO_API_KEY=your_twilio_api_key_here
TWILIO_ACCOUNT_SID=your_twilio_account_sid_here
TWILIO_APP_SID=your_twilio_app_sid_here

# Mailgun Configuration
MAILGUN_API_KEY=your_mailgun_api_key_here

# Database Configuration
DATABASE_PASSWORD=your_database_password_here
REDIS_PASSWORD=your_redis_password_here
POSTGRES_PASSWORD=your_postgres_password_here

# Application Configuration
PASSWORD=your_password_here
APP_SECRET=your_app_secret_here
API_KEY=your_api_key_here
APIKEY=your_apikey_here
ACCESS_TOKEN=your_access_token_here

# Generic Secrets
SOURCE_1=your_source_1_here
SOURCE_2=your_source_2_here
SOURCE_3=your_source_3_here
SOURCE_4=your_source_4_here
SOURCE_5=your_source_5_here
SOURCE_6=your_source_6_here
SOURCE_7=your_source_7_here

# Flask Configuration
FLASK_DEBUG=False
FLASK_SECRET_KEY=your_flask_secret_key_here
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Environment variables
.env
.env.local
.env.*.local

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual Environment
venv/
ENV/
env/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
141 changes: 141 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Security Policy

## Security Improvements Made

This repository has been updated to address critical security vulnerabilities:

### 1. Hardcoded Secrets Removed
- **Issue**: API keys, passwords, and other sensitive credentials were hardcoded in source code
- **Fix**: All hardcoded secrets have been replaced with environment variables using `python-dotenv`
- **Files Modified**:
- `config.py` - All hardcoded credentials replaced with `os.getenv()` calls
- `main.py` - All hardcoded API keys and passwords replaced with environment variables

### 2. Debug Mode Disabled
- **Issue**: Flask application was running with `debug=True` in production
- **Fix**: Debug mode is now controlled via `FLASK_DEBUG` environment variable and defaults to `False`
- **File Modified**: `main.py`

### 3. Configuration Management
- **New Files**:
- `.env.example` - Template for environment variables
- `.gitignore` - Ensures `.env` files are not committed to version control
- `SECURITY.md` - This file documenting security improvements

## Setup Instructions

### 1. Install Dependencies
```bash
pip install -r requirements.txt
```

### 2. Configure Environment Variables
```bash
# Copy the example environment file
cp .env.example .env

# Edit .env with your actual credentials (NEVER commit this file!)
nano .env
```

### 3. Run the Application
```bash
python main.py
```

## Environment Variables Required

The following environment variables must be configured in your `.env` file:

### AWS Configuration
- `AWS_ACCESS_KEY_ID`
- `AWS_ACCESS_SECRET_KEY`
- `MWS_AUTH_TOKEN`

### Google Configuration
- `GCP_PRIVATE_KEY_ID`
- `GCP_PRIVATE_KEY`
- `GOOGLE_API_KEY`
- `GOOGLE_CAPTCHA_KEY`

### GitHub Configuration
- `GITHUB_KEY`
- `GITHUB_CLIENT_ID`
- `GITHUB_APP_SECRET`
- `GITHUB_OAUTH_CLIENT_ID`
- `GITHUB_OAUTH_SECRET`

### Slack Configuration
- `SLACK_CLIENT_ID`
- `SLACK_CLIENT_SECRET`
- `SLACK_SIGNING_SECRET`
- `SLACK_APP_TOKEN`
- `SLACK_OAUTH_ACCESS_TOKEN`
- `SLACK_WEBHOOK`

### Stripe Configuration
- `STRIPE_SECRET_KEY`
- `STRIPE_PUBLISHABLE_KEY`
- `STRIPE_RESTRICTED_KEY`

### Facebook Configuration
- `FACEBOOK_ACCESS_TOKEN`

### Square Configuration
- `SQUARE_ACCESS_TOKEN`
- `SQUARE_OAUTH_SECRET`

### PayPal Configuration
- `PAYPAL_BRAINTREE_ACCESS_TOKEN`

### Twilio Configuration
- `TWILIO_API_KEY`
- `TWILIO_ACCOUNT_SID`
- `TWILIO_APP_SID`

### Mailgun Configuration
- `MAILGUN_API_KEY`

### Database Configuration
- `DATABASE_PASSWORD`
- `REDIS_PASSWORD`
- `POSTGRES_PASSWORD`

### Application Configuration
- `PASSWORD`
- `APP_SECRET`
- `API_KEY`
- `APIKEY`
- `ACCESS_TOKEN`
- `FLASK_SECRET_KEY`
- `FLASK_DEBUG` (set to `False` in production)

### Generic Secrets
- `SOURCE_1` through `SOURCE_7`

## Security Best Practices

1. **Never commit `.env` files** - They contain sensitive credentials
2. **Rotate credentials regularly** - Change API keys and passwords periodically
3. **Use strong, unique passwords** - Avoid weak passwords like "password" or "admin"
4. **Keep dependencies updated** - Regularly update Python packages for security patches
5. **Disable debug mode in production** - Always set `FLASK_DEBUG=False`
6. **Use HTTPS** - Always use encrypted connections for API requests
7. **Implement proper authentication** - Use secure authentication mechanisms
8. **Apply principle of least privilege** - Grant only necessary permissions

## Reporting Security Issues

If you discover a security vulnerability, please report it to the repository maintainers immediately. Do not create public issues for security vulnerabilities.

## Compliance

This security fix addresses the following vulnerability types:
- CWE-798: Use of Hard-coded Credentials
- CWE-489: Active Debug Code
- CWE-200: Exposure of Sensitive Information

## Version History

- **v2.0** (2025-10-26): Security hardening - Removed all hardcoded secrets, disabled debug mode
- **v1.0** (original): Initial version with hardcoded credentials (vulnerable)
Loading