-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (152 loc) · 5.98 KB
/
codeql-analysis.yml
File metadata and controls
173 lines (152 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CodeQL Security Analysis
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
permissions:
actions: read
contents: read
security-events: write
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
strategy:
fail-fast: false
matrix:
language: [python, javascript-typescript]
# Add more languages as needed: java, cpp, csharp, go, ruby, swift
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-extended,security-and-quality
config: |
paths-ignore:
- venv
- node_modules
- build
- dist
- .git
- "**/*.min.js"
- "**/*.bundle.js"
- "_deprecated_*"
- "temporarily_lower_threshold.py"
- "check_chirp_voices.py"
- "setup_tts_voices.py"
- "test_connector.py"
- "test_password_typing.py"
- "test_jarvis_websocket.html"
- "test_jarvis_audio.html"
- "test_actual_coordinates.py"
- "test_pyautogui_direct.py"
- "test_terminal_capture.py"
- "test_multispace_vision.py"
- "backend/tests/archive/**"
- "backend/UNIFIED_ARCHITECTURE_EXAMPLE.py"
- "backend/debug_*"
- "backend/verify_*"
- "backend/start_backend_debug.py"
- "backend/setup_claude_api.py"
- "backend/test_cloud_sql.py"
- "backend/test_vision_websocket.html"
- "backend/apply_advanced_whatsapp_fix.py"
- "backend/enable_parallel_startup.py"
- "backend/update_main_for_parallel.py"
- "backend/migrate_to_rust_performance.py"
- "frontend/public/test-audio.html"
- "frontend/public/debug-audio.html"
- name: Setup Python for Analysis
if: matrix.language == 'python'
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install Python Dependencies
if: matrix.language == 'python'
run: |
python -m pip install --upgrade pip
if [ -f backend/requirements.txt ]; then
pip install -r backend/requirements.txt || true
fi
if [ -f backend/requirements-cloud.txt ]; then
pip install -r backend/requirements-cloud.txt || true
fi
- name: Setup Node for Analysis
if: matrix.language == 'javascript-typescript'
uses: actions/setup-node@v6
with:
node-version: '18'
- name: Install JavaScript Dependencies
if: matrix.language == 'javascript-typescript'
run: |
if [ -f frontend/package.json ]; then
cd frontend
npm ci || npm install
fi
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
upload: true
- name: Generate Security Report
if: always()
run: |
echo "## 🔐 CodeQL Security Analysis - ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Language:** \`${{ matrix.language }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Security analysis completed. Check the Security tab for detailed results." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Queries run:** security-extended, security-and-quality" >> $GITHUB_STEP_SUMMARY
security-scoreboard:
name: Security Scoreboard
runs-on: ubuntu-latest
needs: analyze
if: always()
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Run Security Checks
run: |
echo "## 🛡️ Security Scoreboard" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Check for common security issues
echo "### Security Checklist" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Check for .env in gitignore
if grep -q "^\.env$" .gitignore; then
echo "- ✅ .env is in .gitignore" >> $GITHUB_STEP_SUMMARY
else
echo "- ⚠️ .env may not be in .gitignore" >> $GITHUB_STEP_SUMMARY
fi
# Check for credentials files
if grep -q "credentials" .gitignore; then
echo "- ✅ Credentials files are gitignored" >> $GITHUB_STEP_SUMMARY
else
echo "- ⚠️ Credentials handling unclear" >> $GITHUB_STEP_SUMMARY
fi
# Check for security dependencies
if [ -f backend/requirements.txt ]; then
if grep -q "cryptography\|pycryptodome" backend/requirements.txt; then
echo "- ✅ Cryptography libraries present" >> $GITHUB_STEP_SUMMARY
fi
fi
# Check for GitHub Actions security
if [ -d .github/workflows ]; then
WORKFLOW_COUNT=$(find .github/workflows -name "*.yml" -o -name "*.yaml" | wc -l)
echo "- ✅ $WORKFLOW_COUNT GitHub Actions workflows configured" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**CodeQL Analysis:** Complete" >> $GITHUB_STEP_SUMMARY
echo "**Last Scan:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY