DevSecOps toolkit for AI-assisted secure development
GitHub provides a layered security toolkit. This guide covers setup and best practices for each feature.
Automatically enabled for public repos. For private repos:
Settings → Code security and analysis → Dependabot alerts → Enable
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
open-pull-requests-limit: 10
reviewers:
- "security-team"
labels:
- "dependencies"
- "security"
# Group minor/patch updates to reduce PR noise
groups:
production-dependencies:
patterns:
- "*"
exclude-patterns:
- "@types/*"
- "eslint*"
update-types:
- "minor"
- "patch"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
| Dependency Type | Strategy | Rationale |
|---|---|---|
| Direct production | Pin exact (1.2.3) |
Reproducible builds |
| Dev tooling | Pin minor (^1.2.0) |
Auto-patch updates OK |
| GitHub Actions | Pin SHA | Prevent supply chain attacks |
# .github/workflows/codeql.yml
name: CodeQL Analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 6 * * 1' # Weekly Monday 6am
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
security-events: write
strategy:
matrix:
language: ['javascript', 'python']
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: $
queries: +security-extended
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
/**
* @name Hardcoded credentials
* @description Finds hardcoded passwords and API keys
* @kind problem
* @problem.severity error
* @security-severity 9.0
* @id js/hardcoded-credentials
*/
import javascript
from StringLiteral s
where s.getValue().regexpMatch("(?i)(password|api_key|secret)\\s*[:=]\\s*['\"][^'\"]+['\"]")
select s, "Possible hardcoded credential"
GitHub scans for 200+ secret types from partners (AWS, Azure, GCP, Stripe, etc.).
Settings → Code security → Secret scanning → Custom patterns
# Internal API key format
company_api_[a-zA-Z0-9]{32}
# Internal service tokens
svc-token-[a-f0-9]{64}
Blocks pushes containing detected secrets. Enable via:
Settings → Code security → Secret scanning → Push protection → Enable
# If legitimately blocked, you can:
# 1. Remove the secret and use environment variables
# 2. Mark as false positive (with justification)
# 3. Mark as used in tests (test credentials only)
# Security Policy
## Supported Versions
| Version | Supported |
|---------|-----------|
| 2.x | Yes |
| 1.x | Security fixes only |
| < 1.0 | No |
## Reporting a Vulnerability
1. **Do NOT open a public issue**
2. Use [GitHub Private Vulnerability Reporting](../../security/advisories/new)
3. Or email: security@example.com
4. Expected response time: 48 hours
5. Expected fix time: 7 days for critical, 30 days for others
See Branch Protection & CODEOWNERS for detailed setup.
Use OpenSSF Scorecard to assess your repository:
- name: OSSF Scorecard
uses: ossf/scorecard-action@v2
with:
results_file: results.sarif
results_format: sarif
publish_results: true