Add comprehensive security and contribution documentation
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: '[BUG] '
|
||||
labels: 'bug'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Bug Description
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Expected Behavior
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Actual Behavior
|
||||
What actually happened instead.
|
||||
|
||||
## Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## Environment
|
||||
**Desktop/Server:**
|
||||
- OS: [e.g. Ubuntu 22.04, Windows 11, macOS 13]
|
||||
- Browser (if UI issue): [e.g. Chrome 120, Firefox 121]
|
||||
- Python Version: [e.g. 3.10.5]
|
||||
- Docker Version (if applicable): [e.g. 24.0.7]
|
||||
- DMARQ Version: [e.g. 0.1.0]
|
||||
|
||||
**Deployment Method:**
|
||||
- [ ] Docker Compose
|
||||
- [ ] Manual Python installation
|
||||
- [ ] Other: _____
|
||||
|
||||
## Configuration
|
||||
Relevant configuration (remove sensitive data):
|
||||
```yaml
|
||||
# docker-compose.yml excerpt or .env variables
|
||||
# DO NOT include passwords or secrets
|
||||
```
|
||||
|
||||
## Logs
|
||||
```
|
||||
Paste relevant log output here
|
||||
```
|
||||
|
||||
## Additional Context
|
||||
Add any other context about the problem here.
|
||||
|
||||
## Possible Solution
|
||||
If you have suggestions on how to fix the issue, please describe them here.
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for DMARQ
|
||||
title: '[FEATURE] '
|
||||
labels: 'enhancement'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Feature Description
|
||||
A clear and concise description of the feature you'd like to see.
|
||||
|
||||
## Problem Statement
|
||||
Is your feature request related to a problem? Please describe.
|
||||
Ex. I'm always frustrated when [...]
|
||||
|
||||
## Proposed Solution
|
||||
Describe the solution you'd like to see implemented.
|
||||
|
||||
## Alternatives Considered
|
||||
Describe any alternative solutions or features you've considered.
|
||||
|
||||
## Use Case
|
||||
Describe how this feature would be used and who would benefit from it.
|
||||
|
||||
## Benefits
|
||||
- Benefit 1
|
||||
- Benefit 2
|
||||
- Benefit 3
|
||||
|
||||
## Implementation Ideas
|
||||
If you have ideas about how this could be implemented, share them here.
|
||||
|
||||
## Related Issues/PRs
|
||||
Link to any related issues or pull requests.
|
||||
|
||||
## Mockups/Examples
|
||||
If applicable, add mockups, diagrams, or examples from other tools.
|
||||
|
||||
## Additional Context
|
||||
Add any other context, screenshots, or information about the feature request here.
|
||||
|
||||
## Checklist
|
||||
- [ ] I have searched existing issues to ensure this is not a duplicate
|
||||
- [ ] This feature aligns with DMARQ's mission of privacy-focused DMARC monitoring
|
||||
- [ ] I am willing to contribute to implementing this feature (optional)
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
name: Security Vulnerability
|
||||
about: Report a security issue (CONFIDENTIAL)
|
||||
title: '[SECURITY] '
|
||||
labels: 'security'
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
⚠️ **IMPORTANT: Do not create a public issue for serious security vulnerabilities**
|
||||
|
||||
For serious security vulnerabilities, please email the maintainers directly instead of creating a public issue. See [SECURITY.md](../../SECURITY.md) for contact information.
|
||||
|
||||
---
|
||||
|
||||
## Security Issue Type
|
||||
- [ ] Authentication/Authorization issue
|
||||
- [ ] Data exposure
|
||||
- [ ] Injection vulnerability (SQL, XSS, etc.)
|
||||
- [ ] Cryptography issue
|
||||
- [ ] Dependency vulnerability
|
||||
- [ ] Configuration security
|
||||
- [ ] Other: _____
|
||||
|
||||
## Affected Component
|
||||
- [ ] Backend API
|
||||
- [ ] Frontend/UI
|
||||
- [ ] Database
|
||||
- [ ] Docker configuration
|
||||
- [ ] Documentation
|
||||
- [ ] Dependencies
|
||||
|
||||
## Severity Assessment
|
||||
- [ ] Critical (immediate action required)
|
||||
- [ ] High (significant risk)
|
||||
- [ ] Medium (moderate risk)
|
||||
- [ ] Low (minor risk)
|
||||
|
||||
## Description
|
||||
Describe the security issue in detail.
|
||||
|
||||
## Impact
|
||||
What is the potential impact of this vulnerability?
|
||||
|
||||
## Steps to Reproduce
|
||||
Provide steps to reproduce the vulnerability.
|
||||
|
||||
## Affected Versions
|
||||
Which versions of DMARQ are affected?
|
||||
|
||||
## Suggested Remediation
|
||||
If you have suggestions for fixing the issue, provide them here.
|
||||
|
||||
## References
|
||||
Links to similar vulnerabilities, CVEs, or relevant documentation.
|
||||
|
||||
---
|
||||
|
||||
**Remember**: For critical vulnerabilities, use private disclosure via email instead of public issues.
|
||||
@@ -0,0 +1,91 @@
|
||||
## Description
|
||||
<!-- Provide a clear and concise description of what this PR does -->
|
||||
|
||||
## Related Issue
|
||||
<!-- Link to the issue this PR addresses -->
|
||||
Closes #(issue number)
|
||||
|
||||
## Type of Change
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] Documentation update
|
||||
- [ ] Security fix
|
||||
- [ ] Performance improvement
|
||||
- [ ] Code refactoring
|
||||
|
||||
## Changes Made
|
||||
<!-- List the main changes made in this PR -->
|
||||
- Change 1
|
||||
- Change 2
|
||||
- Change 3
|
||||
|
||||
## Testing Performed
|
||||
<!-- Describe the tests you ran to verify your changes -->
|
||||
|
||||
### Test Environment
|
||||
- Python Version:
|
||||
- Database:
|
||||
- OS:
|
||||
|
||||
### Test Steps
|
||||
1. Step 1
|
||||
2. Step 2
|
||||
3. Step 3
|
||||
|
||||
### Test Results
|
||||
<!-- Paste test output or describe results -->
|
||||
```
|
||||
Paste test results here
|
||||
```
|
||||
|
||||
## Screenshots (if applicable)
|
||||
<!-- Add screenshots to demonstrate UI changes -->
|
||||
|
||||
## Security Considerations
|
||||
<!-- For security-related changes, describe security implications -->
|
||||
- [ ] This PR has been reviewed for security vulnerabilities
|
||||
- [ ] No sensitive data is exposed
|
||||
- [ ] Input validation is implemented
|
||||
- [ ] Authentication/authorization is properly handled
|
||||
- [ ] N/A - No security implications
|
||||
|
||||
## Performance Impact
|
||||
<!-- Describe any performance implications -->
|
||||
- [ ] No significant performance impact
|
||||
- [ ] Performance improved
|
||||
- [ ] Performance impact acceptable for the functionality
|
||||
- [ ] Performance concerns (explain below)
|
||||
|
||||
## Documentation
|
||||
- [ ] Updated relevant documentation
|
||||
- [ ] Added inline code comments for complex logic
|
||||
- [ ] Updated API documentation (if applicable)
|
||||
- [ ] Updated README.md (if applicable)
|
||||
- [ ] No documentation changes needed
|
||||
|
||||
## Checklist
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings or errors
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
- [ ] Any dependent changes have been merged and published
|
||||
|
||||
## AI Assistance (if applicable)
|
||||
<!-- If you used AI coding assistants, please note it here -->
|
||||
- [ ] AI tools were used (GitHub Copilot, Cursor, etc.)
|
||||
- [ ] All AI-generated code has been reviewed for security and correctness
|
||||
- [ ] Tests were added for AI-generated code
|
||||
- [ ] N/A - No AI assistance used
|
||||
|
||||
## Additional Notes
|
||||
<!-- Any additional information that reviewers should know -->
|
||||
|
||||
## Breaking Changes
|
||||
<!-- If this is a breaking change, describe what breaks and migration steps -->
|
||||
|
||||
## Deployment Notes
|
||||
<!-- Special deployment considerations or database migrations required -->
|
||||
@@ -0,0 +1,99 @@
|
||||
name: Security Scanning
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
schedule:
|
||||
# Run weekly on Mondays at 00:00 UTC
|
||||
- cron: '0 0 * * 1'
|
||||
|
||||
jobs:
|
||||
security-scan:
|
||||
name: Security Vulnerability Scan
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install bandit safety detect-secrets
|
||||
cd backend && pip install -r requirements.txt
|
||||
|
||||
- name: Run Bandit (Python Security Linter)
|
||||
run: |
|
||||
bandit -r backend/app -f json -o bandit-report.json || true
|
||||
bandit -r backend/app
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run Safety (Dependency Vulnerability Check)
|
||||
run: |
|
||||
safety check --json || true
|
||||
safety check
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run detect-secrets
|
||||
run: |
|
||||
detect-secrets scan --baseline .secrets.baseline || true
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload Bandit Report
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: bandit-security-report
|
||||
path: bandit-report.json
|
||||
|
||||
codeql-analysis:
|
||||
name: CodeQL Analysis
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'python' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
dependency-review:
|
||||
name: Dependency Review
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dependency Review
|
||||
uses: actions/dependency-review-action@v3
|
||||
with:
|
||||
fail-on-severity: moderate
|
||||
@@ -0,0 +1,130 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test Python ${{ matrix.python-version }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12"]
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14-alpine
|
||||
env:
|
||||
POSTGRES_PASSWORD: test_password
|
||||
POSTGRES_USER: test_user
|
||||
POSTGRES_DB: test_db
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
cd backend
|
||||
pip install -r requirements.txt
|
||||
pip install pytest pytest-cov pytest-asyncio
|
||||
|
||||
- name: Run tests with coverage
|
||||
env:
|
||||
DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db
|
||||
SECRET_KEY: test_secret_key_for_ci
|
||||
run: |
|
||||
cd backend
|
||||
pytest --cov=app --cov-report=xml --cov-report=term-missing
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./backend/coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
lint:
|
||||
name: Lint and Format Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install linting tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pylint black flake8 isort mypy
|
||||
cd backend && pip install -r requirements.txt
|
||||
|
||||
- name: Run Black (format check)
|
||||
run: |
|
||||
black --check backend/app
|
||||
|
||||
- name: Run isort (import order check)
|
||||
run: |
|
||||
isort --check-only backend/app
|
||||
|
||||
- name: Run Flake8
|
||||
run: |
|
||||
flake8 backend/app --max-line-length=100 --extend-ignore=E203,W503
|
||||
|
||||
- name: Run Pylint
|
||||
run: |
|
||||
pylint backend/app --max-line-length=100 --disable=C0111,R0903
|
||||
continue-on-error: true
|
||||
|
||||
docker-build:
|
||||
name: Docker Build Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker compose build
|
||||
|
||||
- name: Test Docker image
|
||||
run: |
|
||||
docker compose up -d
|
||||
sleep 10
|
||||
docker compose ps
|
||||
docker compose logs
|
||||
docker compose down
|
||||
Reference in New Issue
Block a user