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.

refactor(security): simplify danger-zone-alert — fewer labels, explicit paths (#3530)

LearningCircuit42fc75f61d9e
diff --git a/.github/workflows/danger-zone-alert.yml b/.github/workflows/danger-zone-alert.yml
index 062a3dc788..744cdefd49 100644
--- a/.github/workflows/danger-zone-alert.yml
+++ b/.github/workflows/danger-zone-alert.yml
@@ -4,15 +4,12 @@ on:
pull_request:
types: [opened, synchronize]
paths:
- # Only trigger for truly dangerous files
+ # Explicit paths only — no keyword globs. A filename containing
+ # "decrypt" or "password" is not enough to imply security impact.
- 'src/local_deep_research/database/encrypted_db.py'
- 'src/local_deep_research/database/sqlcipher_*.py'
- 'src/local_deep_research/web/auth/**'
- 'src/local_deep_research/security/**'
- - '**/password*.py'
- - '**/encrypt*.py'
- - '**/decrypt*.py'
- - '**/crypto*.py'
permissions: {} # Minimal top-level for OSSF Scorecard Token-Permissions
@@ -36,120 +33,75 @@ jobs:
persist-credentials: false
fetch-depth: 0
- - name: Analyze dangerous changes
+ - name: Classify critical changes
id: analyze
env:
BASE_REF: ${{ github.base_ref }}
run: |
- # Get list of modified files
# Use env var to prevent template injection from malicious branch names
- DANGEROUS_FILES=$(git diff --name-only "origin/$BASE_REF...HEAD" | grep -E "(encrypted_db|sqlcipher|auth/|security/|password|encrypt|decrypt|crypto)" || true)
+ CHANGED=$(git diff --name-only "origin/$BASE_REF...HEAD")
- if [ -z "$DANGEROUS_FILES" ]; then
- echo "No dangerous files modified"
- echo "has_dangers=false" >> "$GITHUB_OUTPUT"
- exit 0
- fi
-
- echo "has_dangers=true" >> "$GITHUB_OUTPUT"
-
- # Analyze each dangerous file
- RISK_LEVEL="HIGH"
- WORKFLOW_CONCLUSION="success"
ENCRYPTION_MODIFIED=false
AUTH_MODIFIED=false
- for file in $DANGEROUS_FILES; do
- 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
+ for file in $CHANGED; do
+ case "$file" in
+ src/local_deep_research/database/encrypted_db.py|src/local_deep_research/database/sqlcipher_*.py)
+ ENCRYPTION_MODIFIED=true ;;
+ src/local_deep_research/web/auth/*|src/local_deep_research/security/*)
+ AUTH_MODIFIED=true ;;
+ esac
done
+ HAS_CRITICAL=false
+ if [ "$ENCRYPTION_MODIFIED" = "true" ] || [ "$AUTH_MODIFIED" = "true" ]; then
+ HAS_CRITICAL=true
+ fi
+
{
- echo "risk_level=$RISK_LEVEL"
- echo "workflow_conclusion=$WORKFLOW_CONCLUSION"
- echo "encryption_modified=$ENCRYPTION_MODIFIED"
- echo "auth_modified=$AUTH_MODIFIED"
- echo "dangerous_files<<EOF"
- echo "$DANGEROUS_FILES"
- echo "EOF"
+ echo "has_critical=$HAS_CRITICAL"
+ echo "encryption_modified=$ENCRYPTION_MODIFIED"
+ echo "auth_modified=$AUTH_MODIFIED"
} >> "$GITHUB_OUTPUT"
- # Note: Comment posting was removed to reduce PR spam - workflow only creates status checks and labels
-
- name: Create status check
- if: steps.analyze.outputs.has_dangers == 'true'
+ if: steps.analyze.outputs.has_critical == 'true'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
- env:
- RISK_LEVEL: ${{ steps.analyze.outputs.risk_level }}
- WORKFLOW_CONCLUSION: ${{ steps.analyze.outputs.workflow_conclusion }}
with:
script: |
- const risk_level = process.env.RISK_LEVEL;
- const workflow_conclusion = process.env.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
+ // Neutral check — advisory, not blocking. Real enforcement, if
+ // desired, belongs in branch-protection rules, not in a status
+ // title that misleads reviewers.
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'Security Review Required',
head_sha: context.sha,
status: 'completed',
- conclusion: workflow_conclusion,
+ conclusion: 'neutral',
output: {
- title: title,
- summary: summary
+ title: 'Security-sensitive paths modified',
+ summary: 'This PR modifies critical security code (encryption or authentication). Please review carefully.'
}
});
- name: Add labels
- if: steps.analyze.outputs.has_dangers == 'true'
+ if: steps.analyze.outputs.has_critical == 'true'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
- WORKFLOW_CONCLUSION: ${{ steps.analyze.outputs.workflow_conclusion }}
ENCRYPTION_MODIFIED: ${{ steps.analyze.outputs.encryption_modified }}
AUTH_MODIFIED: ${{ steps.analyze.outputs.auth_modified }}
- RISK_LEVEL: ${{ steps.analyze.outputs.risk_level }}
with:
script: |
- const labels = ['security-review-needed'];
- const workflow_conclusion = process.env.WORKFLOW_CONCLUSION;
-
- if (process.env.ENCRYPTION_MODIFIED === 'true') {
- labels.push('touches-encryption');
- }
- if (process.env.AUTH_MODIFIED === 'true') {
- labels.push('touches-authentication');
- }
- if (process.env.RISK_LEVEL === 'CRITICAL') {
- labels.push('critical-changes');
- }
- if (workflow_conclusion === 'failure') {
- labels.push('merge-blocked');
+ const labels = [];
+ if (process.env.ENCRYPTION_MODIFIED === 'true') labels.push('touches-encryption');
+ if (process.env.AUTH_MODIFIED === 'true') labels.push('touches-authentication');
+
+ if (labels.length > 0) {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ labels: labels
+ });
}
-
- // Add labels to PR
- await github.rest.issues.addLabels({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number,
- labels: labels
- });