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
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Database Configuration
DB_HOST=localhost
DB_USER=your_username
DB_PASSWORD=your_secure_password
DB_NAME=DATAVERSE

# Security Configuration
SECRET_KEY=your_secret_key_here_change_this_in_production
SESSION_TIMEOUT=3600

# Application Configuration
APP_DEBUG=False
102 changes: 102 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Environment variables
.env

# 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

# PyInstaller
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

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

# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Application specific
appconfig
*.log
plot.png
*.pdf
212 changes: 186 additions & 26 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,199 @@
# Dataverse's Security Policies and Procedures <!-- omit in toc -->
# Security Implementation Documentation

This document outlines security procedures and general policies for the
Dataverse project.
## Overview

- [Reporting a Vulnerability](#reporting-a-vulnerability)
- [Disclosure Policy](#disclosure-policy)
This document outlines the security enhancements implemented in Dataverse to protect user data and prevent common security vulnerabilities.

## Reporting a Vulnerability
## Security Features Implemented

The Dataverse team and community takes all security vulnerabilities
seriously. Thank you for improving the security of our open source
software. We appreciate your efforts and responsible disclosure and will
make every effort to acknowledge your contributions.
### 🔐 Password Security

Report security vulnerabilities by emailing the Dataverse team at:
- **Secure Hashing**: Replaced custom encryption with bcrypt hashing
- **Salt Generation**: Each password gets a unique salt
- **Password Strength**: Enforced strong password requirements
- **Migration Support**: Existing passwords are migrated securely

### 🌍 Environment Configuration

- **Environment Variables**: Database credentials moved to `.env` file
- **Configuration Management**: Centralized configuration with defaults
- **Secret Management**: Secure handling of sensitive configuration

### 🛡️ SQL Injection Prevention

- **Parameterized Queries**: All database queries use parameter binding
- **Input Validation**: Comprehensive validation for all user inputs
- **Data Sanitization**: Automatic sanitization of user data

### 🎫 Session Management

- **Token-Based Sessions**: Secure session tokens using cryptographic random generation
- **Session Timeout**: Automatic session expiration
- **Session Validation**: Proper session validation and cleanup

### 🚫 Account Protection

- **Failed Attempt Tracking**: Monitor and limit failed login attempts
- **Account Lockout**: Temporary account lockout after multiple failures
- **Brute Force Protection**: Protection against brute force attacks

## Security Configuration

### Environment Variables

Create a `.env` file with the following variables:

```env
# Database Configuration
DB_HOST=localhost
DB_USER=your_username
DB_PASSWORD=your_secure_password
DB_NAME=DATAVERSE

# Security Configuration
SECRET_KEY=your_secret_key_here
SESSION_TIMEOUT=3600

# Application Configuration
APP_DEBUG=False
```
multiverse.letter@gmail.com

### Password Requirements

- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one digit
- At least one special character
- Protection against common weak passwords

### Session Configuration

- Default timeout: 1 hour (3600 seconds)
- Automatic cleanup of expired sessions
- Secure token generation using `secrets` module

## Migration Process

### Before Migration

1. **Backup Database**: The migration script automatically creates a backup
2. **Install Dependencies**: Ensure `bcrypt` and `python-dotenv` are installed
3. **Configure Environment**: Set up your `.env` file

### Running Migration

```bash
python migration_script.py
```

The lead maintainer will acknowledge your email within 24 hours and will
send a more detailed response within 48 hours indicating the next steps in
handling your report. After the initial reply to your report, the security
team will endeavor to keep you informed of the progress towards a fix and
full announcement, and may ask for additional information or guidance.
### After Migration

1. **Test Login**: Verify existing users can still log in
2. **Test Registration**: Create new users to test the system
3. **Remove Backup**: Once satisfied, remove the backup table

## Security Best Practices

### For Developers

1. **Never Hardcode Credentials**: Always use environment variables
2. **Use Parameterized Queries**: Never use string formatting for SQL
3. **Validate All Inputs**: Validate and sanitize all user inputs
4. **Handle Errors Securely**: Don't expose sensitive information in errors

### For Deployment

1. **Secure Environment File**: Protect the `.env` file with proper permissions
2. **Use Strong Secrets**: Generate strong, unique secret keys
3. **Regular Updates**: Keep dependencies updated for security patches
4. **Monitor Logs**: Monitor for suspicious activities

## Security Testing

### Manual Testing

1. **SQL Injection**: Test with malicious SQL in input fields
2. **Password Strength**: Test weak password rejection
3. **Session Management**: Test session timeout and validation
4. **Account Lockout**: Test failed login attempt limits

### Automated Testing

Consider implementing:
- Unit tests for validation functions
- Integration tests for authentication
- Security scanning tools
- Dependency vulnerability scanning

## Incident Response

### If Security Issue Detected

1. **Immediate Action**: Change all secrets and passwords
2. **Assess Impact**: Determine what data may have been compromised
3. **Update System**: Apply security patches immediately
4. **Monitor**: Increase monitoring for suspicious activities

### Reporting Security Issues

If you discover a security vulnerability:
1. **Do Not** create a public issue
2. Contact the maintainers privately
3. Provide detailed information about the vulnerability
4. Allow time for the issue to be fixed before disclosure

## Compliance Notes

This implementation follows security best practices including:
- OWASP Top 10 protection guidelines
- Password hashing standards (bcrypt)
- Session management best practices
- Input validation and sanitization standards

## Dependencies

### Security-Related Dependencies

- `bcrypt>=4.0.1`: Secure password hashing
- `python-dotenv>=1.0.0`: Environment variable management

### Security Considerations

- Keep dependencies updated
- Monitor for security advisories
- Use dependency scanning tools

## Changelog

### Version 1.0 (Security Enhancement)

- ✅ Implemented bcrypt password hashing
- ✅ Added environment variable configuration
- ✅ Implemented parameterized queries
- ✅ Added comprehensive input validation
- ✅ Implemented secure session management
- ✅ Added account lockout protection
- ✅ Created migration script for existing data

## Future Enhancements

### Planned Security Improvements

- [ ] Two-factor authentication (2FA)
- [ ] Password reset functionality
- [ ] Audit logging
- [ ] Rate limiting for API endpoints
- [ ] CSRF protection for web interface
- [ ] Content Security Policy (CSP) headers

Report security vulnerabilities in third-party modules to the person or
team maintaining the module.
### Monitoring and Alerting

## Disclosure Policy
- [ ] Failed login attempt monitoring
- [ ] Unusual activity detection
- [ ] Security event logging
- [ ] Automated security scanning

When the security team receives a security bug report, they will assign it
to a primary handler. This person will coordinate the fix and release
process, involving the following steps:
---

* Confirm the problem.
* Audit code to find any potential similar problems.
* Prepare fixes and release them as fast as possible.
For questions about security implementation, please refer to the implementation guide or contact the development team.
16 changes: 4 additions & 12 deletions installation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
PIL
time
Pillow
numpy
ctypes
tkinter
datetime
tabulate
functools
webbrowser
matplotlib
customtkinter
mysql.connector
matplotlib.pyplot
matplotlib.gridspec
matplotlib.widgets
mpl_toolkits.mplot3d
mysql-connector-python
bcrypt>=4.0.1
python-dotenv>=1.0.0
Loading