~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
ci: Add security headers validation workflow
LearningCircuitcb3efbb92479
diff --git a/.github/workflows/security-headers-validation.yml b/.github/workflows/security-headers-validation.ymlnew file mode 100644index 0000000000..3bd78ba418--- /dev/null+++ b/.github/workflows/security-headers-validation.yml@@ -0,0 +1,186 @@+name: Security Headers Validation++on:+ push:+ branches: [main, dev, develop]+ pull_request:+ branches: [main, dev, develop]+ workflow_dispatch:++permissions:+ contents: read++jobs:+ validate-headers:+ runs-on: ubuntu-latest+ timeout-minutes: 15++ services:+ postgres:+ image: postgres:13+ env:+ POSTGRES_USER: postgres+ POSTGRES_PASSWORD: postgres+ POSTGRES_DB: test_db+ options: >-+ --health-cmd pg_isready+ --health-interval 10s+ --health-timeout 5s+ --health-retries 5+ ports:+ - 5432:5432++ steps:+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0++ - name: Set up Python 3.11+ uses: actions/setup-python@v6+ with:+ python-version: '3.11'++ - name: Cache pip packages+ uses: actions/cache@v4+ with:+ path: ~/.cache/pip+ key: ${{ runner.os }}-pip-headers-${{ hashFiles('**/pyproject.toml') }}+ restore-keys: |+ ${{ runner.os }}-pip-headers-+ ${{ runner.os }}-pip-++ - name: Set up PDM+ uses: pdm-project/setup-pdm@v4+ with:+ python-version: '3.11'++ - name: Install system dependencies+ run: |+ sudo apt-get update+ sudo apt-get install -y libsqlcipher-dev build-essential++ - name: Install dependencies+ run: |+ pdm install --dev++ - name: Set up test environment+ run: |+ mkdir -p data+ mkdir -p research_outputs+ cp -r src/local_deep_research/defaults/.env.template .env.test++ - name: Start Flask application in background+ run: |+ export FLASK_ENV=development+ export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/test_db+ pdm run python -m local_deep_research.web.app &+ echo $! > flask.pid+ sleep 10 # Give Flask time to start++ - name: Wait for application to be ready+ run: |+ timeout 60 bash -c 'until curl -s http://localhost:5000/ > /dev/null; do sleep 2; done'++ - name: Validate security headers with curl+ run: |+ echo "=== Testing Security Headers ==="+ echo ""++ # Capture headers+ HEADERS=$(curl -sI http://localhost:5000/)++ echo "Full response headers:"+ echo "$HEADERS"+ echo ""++ # Check for required security headers+ MISSING_HEADERS=()++ if ! echo "$HEADERS" | grep -iq "X-Frame-Options"; then+ MISSING_HEADERS+=("X-Frame-Options")+ fi++ if ! echo "$HEADERS" | grep -iq "X-Content-Type-Options"; then+ MISSING_HEADERS+=("X-Content-Type-Options")+ fi++ if ! echo "$HEADERS" | grep -iq "Referrer-Policy"; then+ MISSING_HEADERS+=("Referrer-Policy")+ fi++ if ! echo "$HEADERS" | grep -iq "Permissions-Policy"; then+ MISSING_HEADERS+=("Permissions-Policy")+ fi++ if ! echo "$HEADERS" | grep -iq "Content-Security-Policy"; then+ MISSING_HEADERS+=("Content-Security-Policy")+ fi++ # Report results+ if [ ${#MISSING_HEADERS[@]} -eq 0 ]; then+ echo "✅ All required security headers are present"+ else+ echo "❌ Missing security headers:"+ for header in "${MISSING_HEADERS[@]}"; do+ echo " - $header"+ done+ exit 1+ fi++ - name: Validate header values+ run: |+ echo "=== Validating Security Header Values ==="+ echo ""++ HEADERS=$(curl -sI http://localhost:5000/)+ INVALID_VALUES=()++ # Validate X-Frame-Options+ XFO=$(echo "$HEADERS" | grep -i "X-Frame-Options" | cut -d':' -f2- | tr -d ' \r\n')+ if [[ "$XFO" != "SAMEORIGIN" && "$XFO" != "DENY" ]]; then+ INVALID_VALUES+=("X-Frame-Options: Expected SAMEORIGIN or DENY, got '$XFO'")+ fi++ # Validate X-Content-Type-Options+ XCTO=$(echo "$HEADERS" | grep -i "X-Content-Type-Options" | cut -d':' -f2- | tr -d ' \r\n')+ if [[ "$XCTO" != "nosniff" ]]; then+ INVALID_VALUES+=("X-Content-Type-Options: Expected nosniff, got '$XCTO'")+ fi++ # Validate Referrer-Policy (should not be unsafe)+ RP=$(echo "$HEADERS" | grep -i "Referrer-Policy" | cut -d':' -f2- | tr -d ' \r\n')+ if [[ "$RP" == "unsafe-url" || "$RP" == "no-referrer-when-downgrade" ]]; then+ INVALID_VALUES+=("Referrer-Policy: Insecure value '$RP'")+ fi++ # Report results+ if [ ${#INVALID_VALUES[@]} -eq 0 ]; then+ echo "✅ All security header values are valid"+ else+ echo "❌ Invalid security header values:"+ for value in "${INVALID_VALUES[@]}"; do+ echo " - $value"+ done+ exit 1+ fi++ - name: Test API endpoint headers+ run: |+ echo "=== Testing Security Headers on API Endpoints ==="+ echo ""++ # Test health endpoint+ API_HEADERS=$(curl -sI http://localhost:5000/api/health)++ if echo "$API_HEADERS" | grep -iq "X-Frame-Options"; then+ echo "✅ Security headers present on API endpoints"+ else+ echo "❌ Security headers missing on API endpoints"+ echo "$API_HEADERS"+ exit 1+ fi++ - name: Cleanup+ if: always()+ run: |+ if [ -f flask.pid ]; then+ kill "$(cat flask.pid)" || true+ fi