ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add Bandit + Safety security scanning to CI and fix vulnerable deps
Juan Denis9604e1ea6687
diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.ymlnew file mode 100644index 00000000..29af9244--- /dev/null+++ b/.github/workflows/security-scan.yml@@ -0,0 +1,70 @@+name: Security Scan++on:+ push:+ branches: [dev]+ paths:+ - 'backend/**'+ - '.github/workflows/security-scan.yml'+ pull_request:+ branches: [main, dev]+ paths:+ - 'backend/**'+ - '.github/workflows/security-scan.yml'++jobs:+ # ──────────────────────────────────────────────────────────────────+ # Job 1: Bandit — static analysis for Python security issues+ # ──────────────────────────────────────────────────────────────────+ bandit:+ name: Bandit SAST+ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v4++ - uses: actions/setup-python@v5+ with:+ python-version: '3.11'++ - name: Install Bandit+ run: pip install bandit++ - name: Run Bandit scan+ working-directory: backend+ run: |+ echo "## Full report (MEDIUM+ severity, MEDIUM+ confidence)"+ echo ""+ bandit -r app/ \+ --severity-level medium \+ --confidence-level medium \+ -f txt \+ --exit-zero+ echo ""+ echo "---"+ echo ""+ echo "## Strict gate (HIGH severity, HIGH confidence, new issues only)"+ echo "Known accepts: B602 (shell=True for build/deploy scripts),"+ echo " B402/B321 (FTP management feature), B202 (tarfile for backups)"+ echo ""+ bandit -r app/ \+ --severity-level high \+ --confidence-level high \+ --skip B602,B402,B321,B202 \+ -f txt++ # ──────────────────────────────────────────────────────────────────+ # Job 2: Safety — dependency vulnerability scanning+ # ──────────────────────────────────────────────────────────────────+ safety:+ name: Safety Dependency Scan+ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v4++ - name: Run Safety CLI to check for vulnerabilities+ uses: pyupio/safety-action@v1+ with:+ api-key: ${{ secrets.SAFETY_API_KEY }}+ args: --full-reportdiff --git a/backend/.bandit b/backend/.banditnew file mode 100644index 00000000..7edcb967--- /dev/null+++ b/backend/.bandit@@ -0,0 +1,9 @@+[bandit]+# Exclude test files from scanning+exclude_dirs = tests,venv,.venv++# Skip checks that are expected noise for a server management tool:+# B404: import_subprocess — we intentionally use subprocess throughout+# B603: subprocess_without_shell_check — we use subprocess.run deliberately+# B607: start_process_with_partial_path — expected for system commands+skips = B404,B603,B607diff --git a/backend/requirements.txt b/backend/requirements.txtindex 70fc4d49..c329fcc5 100644--- a/backend/requirements.txt+++ b/backend/requirements.txt@@ -11,19 +11,19 @@ Flask-JWT-Extended==4.6.0PyJWT==2.8.0# CORS-Flask-Cors==4.0.0+Flask-Cors==5.0.1# WebSocket support-Flask-SocketIO==5.3.6-python-socketio==5.10.0-python-engineio==4.8.1+Flask-SocketIO==5.4.1+python-socketio==5.14.0+python-engineio==4.11.2# System monitoringpsutil==5.9.7# Production server-gunicorn==21.2.0-gevent==23.9.1+gunicorn==22.0.0+gevent==25.4.2gevent-websocket==0.10.1# Environment variables@@ -38,16 +38,16 @@ Flask-Limiter==3.5.0# CLIclick==8.1.7-schedule-passlib-bcrypt+schedule==1.2.2+passlib==1.7.4+bcrypt==4.2.1# Encryption for env vars-cryptography==42.0.0+cryptography==44.0.3# Two-Factor Authenticationpyotp==2.9.0qrcode[pil]==7.4.2# HTTP Requests (for webhooks & notifications)-requests==2.31.0\ No newline at end of file+requests==2.32.5\ No newline at end of file