Files
semantica/.github/workflows/security-scan.yml
T
KaifAhmad1 854f7cbb8c Enhanced security configuration with Dependabot
- Configured bi-weekly security updates with manual review by @KaifAhmad1
- Implemented automated security scans (Monday & Thursday at 7 AM IST) with Bandit, Safety, Semgrep
- Added security-critical package grouping (cryptography, requests, urllib3, certifi, pyopenssl)
- Enterprise-grade security with audit trail, compliance features, and zero auto-merge
- Optimized IST timezone scheduling (Security scans: 7 AM IST, PRs: 9 AM IST)
- Aligned with new Dependabot features: open-source proxy support, smart dependency grouping for Snowflake/Arrow/benchmark features, private registry support, semantic commit prefixes, and latest GitHub security best practices
- Added comprehensive security workflow for automated vulnerability scanning
- Updated CHANGELOG.md with security configuration details

Security enhancements maintain full manual control while providing automated vulnerability protection and enterprise-grade compliance features.
2026-02-09 14:43:55 +05:30

124 lines
4.0 KiB
YAML

name: Security Scan
on:
schedule:
# Run security scan bi-weekly on Monday and Thursday at 7 AM IST (1:30 AM UTC)
- cron: '30 1 * * 1' # Every Monday at 1:30 AM UTC (7 AM IST)
- cron: '30 1 * * 4' # Every Thursday at 1:30 AM UTC (7 AM IST)
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
security-scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install safety bandit semgrep
- name: Run Safety Check (Security Vulnerabilities)
run: |
safety check --json --output safety-report.json || true
safety check
- name: Run Bandit (Security Linter)
run: |
bandit -r semantica/ -f json -o bandit-report.json || true
bandit -r semantica/
- name: Run Semgrep (Static Analysis)
run: |
semgrep --config=auto --json --output=semgrep-report.json semantica/ || true
semgrep --config=auto semantica/
- name: Upload Security Reports
uses: actions/upload-artifact@v3
with:
name: security-reports
path: |
safety-report.json
bandit-report.json
semgrep-report.json
- name: Dependabot Security Scan
uses: github/dependabot-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Security Scorecard
uses: ossf/scorecard-action@v2
with:
results_file: scorecard-results.json
results_format: json
- name: Upload Scorecard Results
uses: actions/upload-artifact@v3
with:
name: scorecard-results
path: scorecard-results.json
- name: Comment PR with Security Results
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
// Read safety report
let safetyResults = '';
try {
const safetyData = JSON.parse(fs.readFileSync('safety-report.json', 'utf8'));
if (safetyData.vulnerabilities && safetyData.vulnerabilities.length > 0) {
safetyResults = `## 🚨 Safety Vulnerabilities Found\\n`;
safetyData.vulnerabilities.forEach(vuln => {
safetyResults += `- **${vuln.package}**: ${vuln.advisory}\\n`;
});
} else {
safetyResults = '## ✅ No Safety Vulnerabilities Found\\n';
}
} catch (e) {
safetyResults = '## ⚠️ Safety scan failed\\n';
}
// Read bandit report
let banditResults = '';
try {
const banditData = JSON.parse(fs.readFileSync('bandit-report.json', 'utf8'));
if (banditData.results && banditData.results.length > 0) {
banditResults = `## 🚨 Bandit Security Issues Found\\n`;
banditData.results.forEach(issue => {
banditResults += `- **${issue.test_name}**: ${issue.filename}:${issue.line_number}\\n`;
});
} else {
banditResults = '## ✅ No Bandit Issues Found\\n';
}
} catch (e) {
banditResults = '## ⚠️ Bandit scan failed\\n';
}
// Create comment
const comment = `# 🔒 Security Scan Results\\n\\n${safetyResults}\\n\\n${banditResults}\\n\\n---\\n\\n*This security scan runs automatically on every PR and daily.*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});