Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

feat: implement severity-based security workflow

LearningCircuit02dde2f188f2
diff --git a/.github/workflows/danger-zone-alert.yml b/.github/workflows/danger-zone-alert.yml
index 6fada8efa7..c5adb16bae 100644
--- a/.github/workflows/danger-zone-alert.yml
+++ b/.github/workflows/danger-zone-alert.yml
@@ -45,6 +45,7 @@ jobs:
# Analyze each dangerous file
RISK_LEVEL="HIGH"
+ WORKFLOW_CONCLUSION="success"
ENCRYPTION_MODIFIED=false
AUTH_MODIFIED=false
SECRETS_MODIFIED=false
@@ -53,10 +54,12 @@ jobs:
if [[ "$file" == *"encrypted_db"* ]] || [[ "$file" == *"sqlcipher"* ]]; then
ENCRYPTION_MODIFIED=true
RISK_LEVEL="CRITICAL"
+ WORKFLOW_CONCLUSION="failure"
fi
if [[ "$file" == *"auth/"* ]] || [[ "$file" == *"password"* ]]; then
AUTH_MODIFIED=true
RISK_LEVEL="CRITICAL"
+ WORKFLOW_CONCLUSION="failure"
fi
if [[ "$file" == *".secrets"* ]]; then
SECRETS_MODIFIED=true
@@ -64,6 +67,7 @@ jobs:
done
echo "risk_level=$RISK_LEVEL" >> $GITHUB_OUTPUT
+ echo "workflow_conclusion=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT
echo "encryption_modified=$ENCRYPTION_MODIFIED" >> $GITHUB_OUTPUT
echo "auth_modified=$AUTH_MODIFIED" >> $GITHUB_OUTPUT
echo "secrets_modified=$SECRETS_MODIFIED" >> $GITHUB_OUTPUT
@@ -72,126 +76,11 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT
- name: Post danger warning comment
- if: steps.analyze.outputs.has_dangers == 'true'
+ if: false # Disabled to reduce PR comment spam while keeping status checks and labels
uses: actions/github-script@v8
with:
script: |
- const risk_level = '${{ steps.analyze.outputs.risk_level }}';
- const encryption_modified = '${{ steps.analyze.outputs.encryption_modified }}' === 'true';
- const auth_modified = '${{ steps.analyze.outputs.auth_modified }}' === 'true';
- const secrets_modified = '${{ steps.analyze.outputs.secrets_modified }}' === 'true';
- const files = `${{ steps.analyze.outputs.dangerous_files }}`.split('\n').filter(f => f);
-
- // Build the warning message
- let message = risk_level === 'CRITICAL'
- ? '# 🚨🚨🚨 CRITICAL SECURITY FILES MODIFIED 🚨🚨🚨\n\n'
- : '# ⚠️ Security-Sensitive Files Modified\n\n';
-
- message += '**This PR modifies security-critical files. Please review with extra care!**\n\n';
-
- // Add specific warnings
- if (encryption_modified) {
- message += '### 🔐 DATABASE ENCRYPTION CHANGES DETECTED\n';
- message += '- Changes to encryption can corrupt existing databases\n';
- message += '- Verify SQLCipher pragma order is correct\n';
- message += '- Test with existing encrypted databases\n';
- message += '- Ensure backward compatibility\n\n';
- }
-
- if (auth_modified) {
- message += '### 🔑 AUTHENTICATION CHANGES DETECTED\n';
- message += '- Could affect user access and security\n';
- message += '- Verify session handling is secure\n';
- message += '- Test login/logout flows thoroughly\n';
- message += '- Check for privilege escalation risks\n\n';
- }
-
- if (secrets_modified) {
- message += '### 🤫 SECRETS CONFIGURATION MODIFIED\n';
- message += '- Changes to secret detection baseline\n';
- message += '- Verify no actual secrets are exposed\n\n';
- }
-
- // List modified files
- message += '### 📁 Modified Security Files:\n';
- for (const file of files) {
- const emoji = file.includes('encrypt') || file.includes('sqlcipher') ? '🔐'
- : file.includes('auth') || file.includes('password') ? '🔑'
- : file.includes('secret') ? '🤫'
- : '⚠️';
- message += `- ${emoji} \`${file}\`\n`;
- }
-
- // Add review checklist
- message += '\n---\n\n';
- message += '## ✅ Required Review Checklist\n\n';
- message += '**Reviewers: Please verify ALL items before approving:**\n\n';
-
- if (encryption_modified) {
- message += '### Encryption Review:\n';
- message += '- [ ] SQLCipher pragmas are in correct order (key before other pragmas)\n';
- message += '- [ ] No hardcoded encryption keys or passwords\n';
- message += '- [ ] Backward compatibility maintained\n';
- message += '- [ ] Tested with existing encrypted databases\n';
- message += '- [ ] Migration path provided if schema changes\n\n';
- }
-
- if (auth_modified) {
- message += '### Authentication Review:\n';
- message += '- [ ] No bypass of authentication checks\n';
- message += '- [ ] Session management is secure\n';
- message += '- [ ] Password hashing uses proper algorithms\n';
- message += '- [ ] No privilege escalation vulnerabilities\n';
- message += '- [ ] Rate limiting still enforced\n\n';
- }
-
- message += '### General Security Review:\n';
- message += '- [ ] No secrets or credentials in code\n';
- message += '- [ ] No debug code that bypasses security\n';
- message += '- [ ] Error messages don\'t leak sensitive info\n';
- message += '- [ ] Logging doesn\'t expose sensitive data\n';
- message += '- [ ] Input validation is proper\n\n';
-
- message += '---\n\n';
- message += '💡 **Tips for reviewers:**\n';
- message += '- Take extra time with these changes\n';
- message += '- Test locally with production-like data\n';
- message += '- When in doubt, request additional review\n';
- message += '- Consider running security tests manually\n\n';
-
- if (risk_level === 'CRITICAL') {
- message += '**⚠️ Due to the critical nature of these changes, please get a second reviewer if possible.**';
- }
-
- // Check if we already posted a comment
- const { data: comments } = await github.rest.issues.listComments({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number
- });
-
- const botComment = comments.find(comment =>
- comment.user.type === 'Bot' &&
- comment.body.includes('SECURITY FILES MODIFIED')
- );
-
- if (botComment) {
- // Update existing comment
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: botComment.id,
- body: message
- });
- } else {
- // Create new comment
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number,
- body: message
- });
- }
+ // Comment posting disabled - workflow now only creates status checks and labels
- name: Create status check
if: steps.analyze.outputs.has_dangers == 'true'
@@ -199,6 +88,18 @@ jobs:
with:
script: |
const risk_level = '${{ steps.analyze.outputs.risk_level }}';
+ const workflow_conclusion = '${{ steps.analyze.outputs.workflow_conclusion }}';
+
+ // Determine status check details based on severity
+ let title, summary;
+
+ if (workflow_conclusion === 'failure') {
+ title = '🚨 CRITICAL Security Changes - Merge Blocked';
+ summary = 'This PR contains CRITICAL security changes that modify database encryption or authentication systems. **Merge is blocked** until these changes are thoroughly reviewed and approved.';
+ } else {
+ title = '⚠️ Security Review Recommended';
+ summary = 'This PR contains security-related changes. Please review carefully before approving, but these changes do not require special approval.';
+ }
// Create a status check that shows in the PR
await github.rest.checks.create({
@@ -207,10 +108,10 @@ jobs:
name: 'Security Review Required',
head_sha: context.sha,
status: 'completed',
- conclusion: 'neutral',
+ conclusion: workflow_conclusion,
output: {
- title: `⚠️ ${risk_level} Risk Security Changes`,
- summary: 'This PR contains changes to security-critical files. Please review the danger zone checklist in the PR comments before approving.'
+ title: title,
+ summary: summary
}
});
@@ -220,6 +121,7 @@ jobs:
with:
script: |
const labels = ['security-review-needed'];
+ const workflow_conclusion = '${{ steps.analyze.outputs.workflow_conclusion }}';
if ('${{ steps.analyze.outputs.encryption_modified }}' === 'true') {
labels.push('touches-encryption');
@@ -230,6 +132,9 @@ jobs:
if ('${{ steps.analyze.outputs.risk_level }}' === 'CRITICAL') {
labels.push('critical-changes');
}
+ if (workflow_conclusion === 'failure') {
+ labels.push('merge-blocked');
+ }
// Add labels to PR
await github.rest.issues.addLabels({