🧙‍♂️ Transform LifeRPG into The Wizard's Grimoire - Production-Ready Application

 Major Features Added:
- Complete magical theming and rebranding from LifeRPG to The Wizard's Grimoire
- Production-grade React frontend with Tailwind CSS v4 and magical aesthetics
- Comprehensive analytics dashboard with Recharts integration (ScryingPortal)
- Push notifications system with PWA service worker support
- Drag & drop functionality using @dnd-kit for habit reordering
- Social features with friends system and leaderboards
- Performance optimization tools and monitoring
- Mobile app enhancement with PWA installation support

🏗️ Technical Infrastructure:
- Advanced service worker with offline support and background sync
- Zustand state management for scalable application state
- Production-ready UI component system with enhanced Button, Card, Input
- Progressive Web App (PWA) with manifest and app installation
- FastAPI backend with comprehensive API endpoints
- Docker containerization and CI/CD pipeline setup

📱 Progressive Web App Features:
- Offline functionality with intelligent caching
- Push notification support for habit reminders
- App installation on mobile and desktop platforms
- Background sync for offline data management
- Performance monitoring and optimization tools

🎨 User Experience:
- Magical wizard/grimoire theming throughout application
- Responsive design optimized for all device sizes
- Drag & drop habit management with smooth animations
- Interactive analytics with multiple chart types
- Social connectivity with friends and competitive features
- Comprehensive notification and performance settings

🔧 Developer Experience:
- Modern development stack with Vite and React
- Comprehensive testing setup and CI/CD pipelines
- Code quality tools with pre-commit hooks
- Docker development environment
- Detailed documentation and implementation guides

This represents a complete transformation from prototype to production-ready application with enterprise-grade features and magical user experience.
This commit is contained in:
TLimoges33
2025-08-30 17:32:42 +00:00
committed by GitHub
parent 00ad1bd8d4
commit 7fe4ae5365
270 changed files with 46366 additions and 7824 deletions
+27
View File
@@ -0,0 +1,27 @@
name: Migration Drift Check
on:
pull_request:
push:
branches: [master]
jobs:
drift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install -r modern/backend/requirements.txt
- name: Generate revision (dry run)
working-directory: modern
run: |
# use a temp alembic dir to detect changes
alembic -c backend/alembic.ini revision --autogenerate -m "drift-check" || true
# If a new file appears in versions with drift-check, fail
if ls backend/alembic/versions | grep -q "drift-check"; then
echo "Model changes detected without migration. Please create an Alembic migration."
exit 1
fi
+295
View File
@@ -0,0 +1,295 @@
name: DB Migrations
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch: {}
jobs:
alembic-sqlite:
runs-on: ubuntu-latest
concurrency:
group: alembic-sqlite-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pyc
uses: actions/cache@v4
with:
path: |
**/__pycache__
key: ${{ runner.os }}-pyc-${{ github.sha }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt alembic
- name: Stamp sqlite (dev default)
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini stamp head
- name: Alembic upgrade sqlite
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
alembic-postgres:
runs-on: ubuntu-latest
concurrency:
group: alembic-postgres-${{ github.ref }}-${{ matrix.python-version }}
cancel-in-progress: true
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: liferpg
ports:
- 5432:5432
options: >-
--health-cmd="bash -lc 'cat < /dev/null > /dev/tcp/127.0.0.1/5432'" \
--health-interval=10s \
--health-timeout=5s \
--health-retries=10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pyc
uses: actions/cache@v4
with:
path: |
**/__pycache__
key: ${{ runner.os }}-pyc-${{ github.sha }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt alembic
- name: Wait for Postgres
run: |
python - <<'PY'
import socket, time, sys
host, port = '127.0.0.1', 5432
for i in range(60):
try:
with socket.create_connection((host, port), timeout=1):
sys.exit(0)
except OSError:
time.sleep(1)
print('Postgres not ready', file=sys.stderr)
sys.exit(1)
PY
- name: Stamp postgres
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini stamp head
- name: Alembic upgrade postgres
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
smoke-api:
runs-on: ubuntu-latest
needs: alembic-sqlite
concurrency:
group: smoke-api-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pyc
uses: actions/cache@v4
with:
path: |
**/__pycache__
key: ${{ runner.os }}-pyc-${{ github.sha }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-3.12-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt uvicorn
- name: Upgrade DB (sqlite)
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
- name: Start API and smoke test
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
(python -m uvicorn modern.backend.app:app --host 127.0.0.1 --port 8000 & echo $! > uvicorn.pid)
# wait for port 8000
python - <<'PY'
import socket, time, sys
for i in range(60):
try:
with socket.create_connection(('127.0.0.1',8000), timeout=1):
sys.exit(0)
except OSError:
time.sleep(1)
print('API not ready', file=sys.stderr)
sys.exit(1)
PY
curl -fsS http://127.0.0.1:8000/health
curl -fsS http://127.0.0.1:8000/api/v1/hello
- name: Stop API
if: always()
run: |
if [ -f uvicorn.pid ]; then kill $(cat uvicorn.pid) || true; fi
drift-check:
runs-on: ubuntu-latest
concurrency:
group: drift-check-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pyc
uses: actions/cache@v4
with:
path: |
**/__pycache__
key: ${{ runner.os }}-pyc-${{ github.sha }}
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt alembic
- name: Run schema drift check
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
python scripts/alembic_check.py
smoke-api-postgres:
runs-on: ubuntu-latest
needs: alembic-postgres
concurrency:
group: smoke-api-postgres-${{ github.ref }}
cancel-in-progress: true
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: liferpg
ports:
- 5432:5432
options: >-
--health-cmd="bash -lc 'cat < /dev/null > /dev/tcp/127.0.0.1/5432'" \
--health-interval=10s \
--health-timeout=5s \
--health-retries=10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache pyc
uses: actions/cache@v4
with:
path: |
**/__pycache__
key: ${{ runner.os }}-pyc-${{ github.sha }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-3.12-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt uvicorn alembic
- name: Wait for Postgres
run: |
python - <<'PY'
import socket, time, sys
host, port = '127.0.0.1', 5432
for i in range(60):
try:
with socket.create_connection((host, port), timeout=1):
sys.exit(0)
except OSError:
time.sleep(1)
print('Postgres not ready', file=sys.stderr)
sys.exit(1)
PY
- name: Upgrade DB (postgres)
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
- name: Start API and smoke test (postgres)
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
(python -m uvicorn modern.backend.app:app --host 127.0.0.1 --port 8000 & echo $! > uvicorn.pid)
# wait for port 8000
python - <<'PY'
import socket, time, sys
for i in range(60):
try:
with socket.create_connection(('127.0.0.1',8000), timeout=1):
sys.exit(0)
except OSError:
time.sleep(1)
print('API not ready', file=sys.stderr)
sys.exit(1)
PY
curl -fsS http://127.0.0.1:8000/health
curl -fsS http://127.0.0.1:8000/api/v1/hello
- name: Stop API
if: always()
run: |
if [ -f uvicorn.pid ]; then kill $(cat uvicorn.pid) || true; fi
+103
View File
@@ -0,0 +1,103 @@
name: Nightly DB Drift Check
on:
schedule:
- cron: "0 3 * * *" # daily at 03:00 UTC
workflow_dispatch: {}
jobs:
drift-postgres:
runs-on: ubuntu-latest
concurrency:
group: drift-postgres-${{ github.ref }}
cancel-in-progress: true
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: liferpg
ports:
- 5432:5432
options: >-
--health-cmd="bash -lc 'cat < /dev/null > /dev/tcp/127.0.0.1/5432'" \
--health-interval=10s \
--health-timeout=5s \
--health-retries=10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-3.12-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt alembic
- name: Wait for Postgres
run: |
python - <<'PY'
import socket, time, sys
host, port = '127.0.0.1', 5432
for i in range(60):
try:
with socket.create_connection((host, port), timeout=1):
sys.exit(0)
except OSError:
time.sleep(1)
print('Postgres not ready', file=sys.stderr)
sys.exit(1)
PY
- name: Create DB schema
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
- name: Run schema drift check (Postgres)
env:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/liferpg
run: |
export PYTHONPATH=$(pwd)
python scripts/alembic_check.py
drift-sqlite:
runs-on: ubuntu-latest
concurrency:
group: drift-sqlite-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements*.txt', 'poetry.lock', 'Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-3.12-
- name: Install deps
run: |
python -m pip install --upgrade pip
python -m pip install -r modern/backend/requirements_full.txt alembic
- name: Upgrade DB
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
alembic -c modern/alembic.ini upgrade head
- name: Drift check (sqlite)
env:
DATABASE_URL: sqlite:///./modern_dev.db
run: |
export PYTHONPATH=$(pwd)
python scripts/alembic_check.py
+182
View File
@@ -0,0 +1,182 @@
name: Generate SBOM
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
# Generate SBOM weekly
- cron: "0 3 * * 2"
workflow_dispatch:
jobs:
generate-sbom:
name: Generate Software Bill of Materials
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Python dependencies
run: |
cd modern/backend
pip install -r requirements.txt
- name: Install Node.js dependencies
run: |
cd modern/frontend
npm ci
- name: Install SBOM generators
run: |
# Install SPDX tools
npm install -g @cyclonedx/cyclonedx-npm
pip install cyclonedx-bom
# Install Syft for comprehensive SBOM generation
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Generate Python SBOM (CycloneDX)
run: |
cd modern/backend
cyclonedx-py -o liferpg-backend-sbom.json
cyclonedx-py -o liferpg-backend-sbom.xml --format xml
- name: Generate Node.js SBOM (CycloneDX)
run: |
cd modern/frontend
cyclonedx-npm --output-file liferpg-frontend-sbom.json
cyclonedx-npm --output-format xml --output-file liferpg-frontend-sbom.xml
- name: Generate comprehensive SBOM with Syft
run: |
# Generate SBOM for the entire project
syft . -o spdx-json=liferpg-complete-sbom.spdx.json
syft . -o cyclonedx-json=liferpg-complete-sbom.cyclonedx.json
# Generate SBOM for backend
syft modern/backend -o spdx-json=liferpg-backend-syft.spdx.json
# Generate SBOM for frontend
syft modern/frontend -o spdx-json=liferpg-frontend-syft.spdx.json
- name: Generate dependency tree
run: |
echo "# LifeRPG Dependency Analysis" > dependency-analysis.md
echo "" >> dependency-analysis.md
echo "Generated on: $(date)" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "## Python Backend Dependencies" >> dependency-analysis.md
echo "\`\`\`" >> dependency-analysis.md
cd modern/backend
pip list --format=freeze >> ../../dependency-analysis.md
cd ../..
echo "\`\`\`" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "## Node.js Frontend Dependencies" >> dependency-analysis.md
echo "\`\`\`" >> dependency-analysis.md
cd modern/frontend
npm list --depth=0 >> ../../dependency-analysis.md 2>&1 || true
cd ../..
echo "\`\`\`" >> dependency-analysis.md
- name: Generate security audit
run: |
echo "## Security Audit Results" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "### Python Security Audit (pip-audit)" >> dependency-analysis.md
pip install pip-audit
echo "\`\`\`" >> dependency-analysis.md
cd modern/backend
pip-audit --format=text >> ../../dependency-analysis.md 2>&1 || echo "No vulnerabilities found" >> ../../dependency-analysis.md
cd ../..
echo "\`\`\`" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "### Node.js Security Audit" >> dependency-analysis.md
echo "\`\`\`" >> dependency-analysis.md
cd modern/frontend
npm audit --audit-level=high >> ../../dependency-analysis.md 2>&1 || echo "No high/critical vulnerabilities found" >> ../../dependency-analysis.md
cd ../..
echo "\`\`\`" >> dependency-analysis.md
- name: Generate license summary
run: |
echo "## License Summary" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "### Python Package Licenses" >> dependency-analysis.md
pip install pip-licenses
echo "\`\`\`" >> dependency-analysis.md
cd modern/backend
pip-licenses --format=markdown --output-file=../../python-licenses.md
cat ../../python-licenses.md >> ../../dependency-analysis.md
cd ../..
echo "\`\`\`" >> dependency-analysis.md
echo "" >> dependency-analysis.md
echo "### Node.js Package Licenses" >> dependency-analysis.md
echo "\`\`\`" >> dependency-analysis.md
cd modern/frontend
npx license-checker --summary >> ../../dependency-analysis.md 2>&1 || echo "License checker not available" >> ../../dependency-analysis.md
cd ../..
echo "\`\`\`" >> dependency-analysis.md
- name: Upload SBOM artifacts
uses: actions/upload-artifact@v3
with:
name: sbom-files
path: |
modern/backend/liferpg-backend-sbom.*
modern/frontend/liferpg-frontend-sbom.*
liferpg-complete-sbom.*
liferpg-*-syft.*
dependency-analysis.md
python-licenses.md
- name: Create SBOM release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create a release with SBOM files
gh release create "sbom-$(date +%Y%m%d-%H%M%S)" \
--title "SBOM $(date +%Y-%m-%d)" \
--notes "Software Bill of Materials generated automatically" \
--prerelease \
modern/backend/liferpg-backend-sbom.json \
modern/frontend/liferpg-frontend-sbom.json \
liferpg-complete-sbom.cyclonedx.json \
liferpg-complete-sbom.spdx.json \
dependency-analysis.md
- name: Summary
run: |
echo "## SBOM Generation Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Generated SBOM files:" >> $GITHUB_STEP_SUMMARY
echo "- Backend SBOM (CycloneDX): liferpg-backend-sbom.json" >> $GITHUB_STEP_SUMMARY
echo "- Frontend SBOM (CycloneDX): liferpg-frontend-sbom.json" >> $GITHUB_STEP_SUMMARY
echo "- Complete SBOM (CycloneDX): liferpg-complete-sbom.cyclonedx.json" >> $GITHUB_STEP_SUMMARY
echo "- Complete SBOM (SPDX): liferpg-complete-sbom.spdx.json" >> $GITHUB_STEP_SUMMARY
echo "- Dependency Analysis: dependency-analysis.md" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "SBOM files contain comprehensive dependency information for security and compliance purposes." >> $GITHUB_STEP_SUMMARY
+262
View File
@@ -0,0 +1,262 @@
name: Security Scans
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master]
schedule:
# Run weekly security scans
- cron: "0 2 * * 1"
jobs:
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["javascript", "python"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Override default queries with custom ones
queries: +security-and-quality
- name: Set up Python
if: matrix.language == 'python'
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
if: matrix.language == 'python'
run: |
cd modern/backend
pip install -r requirements.txt
- name: Set up Node.js
if: matrix.language == 'javascript'
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Node.js dependencies
if: matrix.language == 'javascript'
run: |
cd modern/frontend
npm ci
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
snyk:
name: Snyk Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Snyk CLI
run: npm install -g snyk
- name: Authenticate Snyk
run: snyk auth ${{ secrets.SNYK_TOKEN }}
continue-on-error: true
- name: Snyk test for Python backend
run: |
cd modern/backend
pip install -r requirements.txt
snyk test --severity-threshold=high
continue-on-error: true
- name: Snyk test for Node.js frontend
run: |
cd modern/frontend
npm ci
snyk test --severity-threshold=high
continue-on-error: true
- name: Snyk monitor
run: |
cd modern/backend && snyk monitor
cd ../frontend && snyk monitor
continue-on-error: true
dependency-scan:
name: Dependency Vulnerability Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
scan-ref: "."
format: "sarif"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: "trivy-results.sarif"
semgrep:
name: Semgrep SAST
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Semgrep
uses: semgrep/semgrep-action@v1
with:
config: >-
p/security-audit
p/secrets
p/owasp-top-ten
p/python
p/javascript
generateSarif: "1"
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: semgrep.sarif
bandit:
name: Bandit Python Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Bandit
run: pip install bandit[toml]
- name: Run Bandit scan
run: |
cd modern/backend
bandit -r . -f json -o bandit-report.json || true
bandit -r . -f txt
- name: Upload Bandit results
uses: actions/upload-artifact@v3
if: always()
with:
name: bandit-results
path: modern/backend/bandit-report.json
eslint-security:
name: ESLint Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install dependencies
run: |
cd modern/frontend
npm ci
- name: Install ESLint security plugins
run: |
cd modern/frontend
npm install --save-dev eslint-plugin-security eslint-plugin-no-secrets
- name: Run ESLint security scan
run: |
cd modern/frontend
npx eslint . --ext .js,.jsx,.ts,.tsx --config .eslintrc.security.js || true
docker-security:
name: Docker Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker images
run: |
cd modern
docker build -t liferpg-backend -f Dockerfile.backend .
docker build -t liferpg-frontend -f frontend/Dockerfile frontend/
- name: Run Trivy on Docker images
run: |
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/Library/Caches:/root/.cache/ \
aquasec/trivy image liferpg-backend
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/Library/Caches:/root/.cache/ \
aquasec/trivy image liferpg-frontend
secrets-scan:
name: Secrets Detection
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run TruffleHog
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: main
head: HEAD
extra_args: --debug --only-verified
security-summary:
name: Security Summary
runs-on: ubuntu-latest
needs: [codeql, dependency-scan, semgrep, bandit, eslint-security]
if: always()
steps:
- name: Security Scan Summary
run: |
echo "## Security Scan Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Scan Type | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| CodeQL | ${{ needs.codeql.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Dependency Scan | ${{ needs.dependency-scan.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Semgrep SAST | ${{ needs.semgrep.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Bandit | ${{ needs.bandit.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| ESLint Security | ${{ needs.eslint-security.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Check the Security tab for detailed results." >> $GITHUB_STEP_SUMMARY