Security audit workflow - vulnerability scan β verification
npx skills add josavicentevw/ai-agent-skills --skill "devsecops"
Install specific skill from multi-skill repository
# Description
DevSecOps skill for security automation, vulnerability management, secure CI/CD pipelines, container security, secrets management, compliance, and security testing. Use when implementing security in development workflows, scanning for vulnerabilities, securing infrastructure, or when user mentions security automation, SAST, DAST, container scanning, or compliance.
# SKILL.md
name: devsecops
description: DevSecOps skill for security automation, vulnerability management, secure CI/CD pipelines, container security, secrets management, compliance, and security testing. Use when implementing security in development workflows, scanning for vulnerabilities, securing infrastructure, or when user mentions security automation, SAST, DAST, container scanning, or compliance.
DevSecOps
A comprehensive DevSecOps skill that helps integrate security practices throughout the software development lifecycle, from code to production.
Quick Start
Basic DevSecOps workflow:
# Shift security left
# Automate security checks in CI/CD
# Scan code, dependencies, containers, infrastructure
# Monitor and respond to security incidents
# Maintain compliance and audit trails
Core Capabilities
1. Security Scanning
Static Application Security Testing (SAST)
- Code analysis for security vulnerabilities
- Pattern detection for common flaws (SQL injection, XSS, etc.)
- Security code review automation
- Tools: SonarQube, Checkmarx, Semgrep, CodeQL
Dynamic Application Security Testing (DAST)
- Runtime security testing
- API security testing
- Penetration testing automation
- Tools: OWASP ZAP, Burp Suite, Acunetix
Software Composition Analysis (SCA)
- Dependency vulnerability scanning
- License compliance checking
- Open source security
- Tools: Snyk, Dependabot, WhiteSource, Black Duck
2. Container Security
Image Scanning
- Vulnerability scanning for base images
- Malware detection
- Configuration analysis
- Tools: Trivy, Clair, Anchore, Aqua Security
Runtime Security
- Container behavior monitoring
- Anomaly detection
- Runtime policy enforcement
- Tools: Falco, Sysdig, Aqua, Twistlock
Kubernetes Security
- Pod security policies
- Network policies
- RBAC configuration
- Admission controllers
- Tools: OPA, Kyverno, Falco, KubeSec
3. Infrastructure Security
Infrastructure as Code (IaC) Scanning
- Terraform security analysis
- CloudFormation scanning
- Kubernetes manifests validation
- Tools: Checkov, tfsec, Terrascan, kube-score
Cloud Security Posture Management (CSPM)
- AWS/Azure/GCP security configuration
- Compliance monitoring
- Misconfiguration detection
- Tools: AWS Security Hub, Azure Security Center, Prowler
Network Security
- Firewall rules analysis
- Network segmentation
- Traffic monitoring
- Security groups validation
4. Secrets Management
Secret Scanning
- Detect hardcoded credentials in code
- Git history scanning
- Configuration file analysis
- Tools: GitGuardian, TruffleHog, git-secrets, Gitleaks
Secret Storage & Rotation
- Centralized secret management
- Automated rotation
- Access control and auditing
- Tools: HashiCorp Vault, AWS Secrets Manager, Azure Key Vault
5. CI/CD Pipeline Security
Pipeline Hardening
- Secure pipeline configuration
- Build environment isolation
- Artifact signing and verification
- Supply chain security
Security Gates
- Automated security checks in pipeline
- Quality gates based on severity
- Break the build on critical issues
- Exception management
Compliance Automation
- SOC 2, HIPAA, PCI-DSS checks
- Policy as code
- Automated evidence collection
- Audit trail generation
6. Application Security
API Security
- API authentication and authorization
- Rate limiting and throttling
- Input validation
- API gateway security
Authentication & Authorization
- OAuth2/OIDC implementation
- JWT validation
- RBAC and ABAC
- Multi-factor authentication
Data Security
- Encryption at rest and in transit
- Data masking and anonymization
- Key management
- PII/PHI protection
7. Monitoring & Incident Response
Security Monitoring
- SIEM integration
- Log aggregation and analysis
- Threat detection
- Tools: ELK Stack, Splunk, Datadog Security
Vulnerability Management
- CVE tracking and prioritization
- Patch management
- Vulnerability disclosure
- SLA management
Incident Response
- Security incident playbooks
- Automated remediation
- Post-incident analysis
- Lessons learned documentation
8. Compliance & Governance
Compliance Frameworks
- SOC 2 Type II
- ISO 27001
- HIPAA
- PCI-DSS
- GDPR
Policy Management
- Security policies as code
- Policy enforcement
- Exception tracking
- Regular audits
Risk Assessment
- Threat modeling
- Risk scoring
- Attack surface analysis
- Security metrics and KPIs
Workflows
Secure SDLC Workflow
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SECURE SDLC β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. PLAN & DESIGN
βββ Threat modeling
βββ Security requirements
βββ Architecture security review
2. DEVELOP
βββ Secure coding guidelines
βββ IDE security plugins
βββ Pre-commit hooks (secret scanning)
βββ Security-focused code reviews
3. BUILD
βββ SAST (static code analysis)
βββ SCA (dependency scanning)
βββ Container image scanning
βββ IaC security scanning
4. TEST
βββ DAST (dynamic testing)
βββ API security testing
βββ Penetration testing
βββ Security regression testing
5. DEPLOY
βββ Container runtime security
βββ Infrastructure security validation
βββ Secrets injection
βββ Security configuration checks
6. OPERATE
βββ Runtime monitoring
βββ Vulnerability management
βββ Incident response
βββ Compliance monitoring
7. MONITOR
βββ Security logging
βββ Threat detection
βββ Anomaly detection
βββ Security metrics
CI/CD Security Pipeline
# Example: Security-Integrated Pipeline
stages:
- security-scan
- build
- test
- security-test
- deploy
# Stage 1: Pre-build Security
security-scan:
stage: security-scan
script:
# Secret scanning
- trufflehog --regex --entropy=False .
# SAST scanning
- semgrep --config=auto --sarif > sast-results.sarif
# Dependency scanning
- snyk test --severity-threshold=high
# IaC scanning
- checkov -d . --framework terraform
artifacts:
reports:
sast: sast-results.sarif
# Stage 2: Build with security
build:
stage: build
script:
- docker build -t myapp:$CI_COMMIT_SHA .
# Sign container image
- cosign sign myapp:$CI_COMMIT_SHA
# Stage 3: Container scanning
container-scan:
stage: test
script:
- trivy image --severity HIGH,CRITICAL myapp:$CI_COMMIT_SHA
- docker scan myapp:$CI_COMMIT_SHA
allow_failure: false # Break build on critical issues
# Stage 4: Dynamic security testing
dast:
stage: security-test
script:
# Deploy to staging
- kubectl apply -f k8s/staging/
# Run DAST
- zap-baseline.py -t https://staging.example.com
# API security test
- postman collection run security-tests.json
# Stage 5: Deploy with security
deploy:
stage: deploy
script:
# Verify image signature
- cosign verify myapp:$CI_COMMIT_SHA
# Apply security policies
- kubectl apply -f k8s/policies/
# Deploy application
- kubectl apply -f k8s/production/
# Verify deployment security
- kube-bench run --targets master,node
Vulnerability Management Process
1. DISCOVERY
βββ Scan code, dependencies, containers, infrastructure
2. PRIORITIZATION
βββ Severity assessment (CVSS score)
βββ Exploitability analysis
βββ Business impact evaluation
βββ Risk scoring
3. TRIAGE
βββ Assign ownership
βββ Set SLA based on severity
βββ Create remediation tickets
βββ Track in vulnerability management system
4. REMEDIATION
βββ Update dependencies
βββ Apply patches
βββ Implement workarounds
βββ Verify fixes
5. VALIDATION
βββ Re-scan to confirm fix
βββ Test for regressions
βββ Close vulnerability ticket
6. REPORTING
βββ Update security dashboard
βββ Notify stakeholders
βββ Document lessons learned
Security Patterns
Defense in Depth
Layer 1: Network Security
βββ Firewall rules
βββ Network segmentation
βββ DDoS protection
βββ WAF (Web Application Firewall)
Layer 2: Application Security
βββ Input validation
βββ Output encoding
βββ Authentication & authorization
βββ Session management
Layer 3: Data Security
βββ Encryption at rest
βββ Encryption in transit
βββ Data masking
βββ Access controls
Layer 4: Infrastructure Security
βββ OS hardening
βββ Patch management
βββ Security configuration
βββ Vulnerability scanning
Layer 5: Monitoring & Response
βββ Security logging
βββ SIEM
βββ Incident response
βββ Threat intelligence
Zero Trust Architecture
1. VERIFY EXPLICITLY
βββ Authenticate every request
βββ Authorize based on all data points
βββ Use multi-factor authentication
2. LEAST PRIVILEGE ACCESS
βββ Just-in-time access
βββ Risk-based adaptive policies
βββ Data protection
3. ASSUME BREACH
βββ Minimize blast radius
βββ Segment access
βββ End-to-end encryption
βββ Analytics for visibility
Security by Technology Stack
React/TypeScript
Security Concerns:
- XSS vulnerabilities
- Dependency vulnerabilities
- API security
- Authentication token storage
Tools & Practices:
# Dependency scanning
npm audit
snyk test
# SAST scanning
eslint --plugin security
semgrep --config=p/react
# Content Security Policy
# Add to HTML or headers
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'
Secure Coding:
// β
GOOD: Sanitize user input
import DOMPurify from 'dompurify';
const SafeComponent: React.FC<{html: string}> = ({html}) => {
const sanitized = DOMPurify.sanitize(html);
return <div dangerouslySetInnerHTML={{__html: sanitized}} />;
};
// β BAD: Direct use of dangerouslySetInnerHTML
const UnsafeComponent = ({html}) => (
<div dangerouslySetInnerHTML={{__html: html}} />
);
// β
GOOD: Secure token storage
// Store JWT in httpOnly cookie, not localStorage
// Use secure, sameSite=strict cookies
// β BAD: Storing tokens in localStorage
localStorage.setItem('token', jwt); // Vulnerable to XSS
Python/FastAPI
Security Concerns:
- SQL injection
- Command injection
- Insecure deserialization
- Dependency vulnerabilities
Tools & Practices:
# Dependency scanning
safety check
pip-audit
snyk test --file=requirements.txt
# SAST scanning
bandit -r .
semgrep --config=p/python
# Secret scanning
detect-secrets scan
Secure Coding:
# β
GOOD: Use parameterized queries
from sqlalchemy import text
def get_user(user_id: int):
query = text("SELECT * FROM users WHERE id = :id")
result = db.execute(query, {"id": user_id})
return result.first()
# β BAD: String concatenation (SQL injection)
def get_user_unsafe(user_id: str):
query = f"SELECT * FROM users WHERE id = {user_id}"
return db.execute(query)
# β
GOOD: Input validation
from pydantic import BaseModel, validator
class UserCreate(BaseModel):
email: str
password: str
@validator('password')
def validate_password(cls, v):
if len(v) < 8:
raise ValueError('Password must be at least 8 characters')
return v
# β
GOOD: Rate limiting
from slowapi import Limiter
from slowapi.util import get_remote_address
limiter = Limiter(key_func=get_remote_address)
@app.post("/api/login")
@limiter.limit("5/minute")
async def login(credentials: LoginRequest):
return await authenticate(credentials)
Java/Spring Boot
Security Concerns:
- Deserialization vulnerabilities
- XXE (XML External Entity)
- LDAP injection
- Dependency vulnerabilities
Tools & Practices:
# Dependency scanning
mvn dependency-check:check
snyk test
# SAST scanning
spotbugs -effort:max -low
semgrep --config=p/java
# Container scanning
trivy image myapp:latest
Secure Coding:
// β
GOOD: Use prepared statements
public User getUserById(int userId) {
String sql = "SELECT * FROM users WHERE id = ?";
return jdbcTemplate.queryForObject(sql, new Object[]{userId},
new UserRowMapper());
}
// β BAD: String concatenation
public User getUserByIdUnsafe(int userId) {
String sql = "SELECT * FROM users WHERE id = " + userId;
return jdbcTemplate.queryForObject(sql, new UserRowMapper());
}
// β
GOOD: Spring Security configuration
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.authorizeRequests()
.antMatchers("/api/public/**").permitAll()
.anyRequest().authenticated()
.and()
.oauth2ResourceServer().jwt();
return http.build();
}
}
// β
GOOD: Secure password hashing
@Service
public class PasswordService {
private final PasswordEncoder encoder = new BCryptPasswordEncoder(12);
public String hashPassword(String plainPassword) {
return encoder.encode(plainPassword);
}
}
Kubernetes/Docker
Security Concerns:
- Container breakout
- Privilege escalation
- Insecure configurations
- Supply chain attacks
Tools & Practices:
# Container scanning
trivy image nginx:latest
docker scan nginx:latest
grype nginx:latest
# K8s security scanning
kubesec scan pod.yaml
kube-bench
kube-hunter
# Policy enforcement
kubectl apply -f pod-security-policy.yaml
gatekeeper install
Secure Configurations:
# β
GOOD: Secure Pod configuration
apiVersion: v1
kind: Pod
metadata:
name: secure-pod
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
seccompProfile:
type: RuntimeDefault
containers:
- name: app
image: myapp:latest
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
resources:
limits:
cpu: "1"
memory: "512Mi"
requests:
cpu: "0.5"
memory: "256Mi"
livenessProbe:
httpGet:
path: /health
port: 8080
readinessProbe:
httpGet:
path: /ready
port: 8080
# β
GOOD: Network Policy
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: api-network-policy
spec:
podSelector:
matchLabels:
app: api
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
app: frontend
ports:
- protocol: TCP
port: 8080
egress:
- to:
- podSelector:
matchLabels:
app: database
ports:
- protocol: TCP
port: 5432
Security Tools Integration
GitHub Actions Security Pipeline
name: Security Pipeline
on: [push, pull_request]
jobs:
secret-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TruffleHog Secret Scan
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
sast:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Semgrep
uses: returntocorp/semgrep-action@v1
with:
config: >-
p/security-audit
p/secrets
p/owasp-top-ten
- name: Run CodeQL
uses: github/codeql-action/analyze@v2
dependency-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Snyk
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
container-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build -t myapp:${{ github.sha }} .
- name: Run Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: myapp:${{ github.sha }}
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
iac-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Checkov
uses: bridgecrewio/checkov-action@master
with:
directory: infrastructure/
framework: terraform
output_format: sarif
output_file_path: checkov-results.sarif
GitLab CI Security Pipeline
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Container-Scanning.gitlab-ci.yml
- template: Security/DAST.gitlab-ci.yml
variables:
SECURE_LOG_LEVEL: "debug"
stages:
- test
- security
- deploy
security-scan:
stage: security
image: securego/gosec:latest
script:
- gosec -fmt json -out gosec-report.json ./...
artifacts:
reports:
sast: gosec-report.json
custom-container-scan:
stage: security
image: aquasec/trivy:latest
script:
- trivy image --exit-code 1 --severity CRITICAL $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
Compliance Frameworks
SOC 2 Type II
Key Controls:
CC6.1: Logical and Physical Access Controls
βββ Multi-factor authentication
βββ Password policies
βββ Access reviews (quarterly)
βββ Privileged access management
CC6.2: System Monitoring
βββ Security logging enabled
βββ Log retention (1 year)
βββ SIEM implementation
βββ Anomaly detection
CC7.1: Threat Detection
βββ Vulnerability scanning (weekly)
βββ Penetration testing (annual)
βββ Security awareness training
βββ Incident response plan
CC7.2: Infrastructure Security
βββ Network segmentation
βββ Encryption at rest and in transit
βββ Patch management
βββ Configuration management
PCI-DSS
Requirements:
Requirement 1: Firewall Configuration
βββ Network diagram documentation
βββ Firewall rule reviews (6 months)
βββ DMZ implementation
Requirement 2: System Security
βββ Change default passwords
βββ Disable unnecessary services
βββ Security configuration standards
Requirement 3: Protect Cardholder Data
βββ Data encryption
βββ Minimize data retention
βββ Secure key management
Requirement 6: Secure Development
βββ Security training for developers
βββ SAST/DAST scanning
βββ Code review process
βββ Vulnerability management
Requirement 10: Logging and Monitoring
βββ Audit trails
βββ Log review
βββ Time synchronization
βββ Log protection
Requirement 11: Security Testing
βββ Quarterly vulnerability scans
βββ Annual penetration testing
βββ IDS/IPS deployment
βββ File integrity monitoring
Security Metrics & KPIs
Key Metrics to Track
1. VULNERABILITY METRICS
βββ Mean Time to Detect (MTTD): < 24 hours
βββ Mean Time to Remediate (MTTR): < 30 days (critical), < 90 days (high)
βββ Vulnerability density: # of vulnerabilities per 1000 lines of code
βββ False positive rate: < 10%
2. SECURITY TESTING COVERAGE
βββ Code coverage by SAST: > 80%
βββ API endpoints covered by DAST: > 90%
βββ Dependencies scanned: 100%
βββ Containers scanned: 100%
3. PIPELINE SECURITY
βββ Security gate failures: Track trend
βββ Time added by security scans: < 10% of total build time
βββ Security exceptions granted: < 5% of findings
βββ Pipeline security incidents: 0
4. INCIDENT RESPONSE
βββ Security incidents: Track count and trend
βββ Incident response time: < 1 hour
βββ Incident resolution time: Based on severity
βββ Post-incident reviews completed: 100%
5. COMPLIANCE
βββ Policy compliance rate: > 95%
βββ Audit findings: Track and trend
βββ Training completion: 100% annually
βββ Access reviews completed: 100% quarterly
Security Dashboard
βββββββββββββββββββββββββββββββββββββββββββββββ
β SECURITY DASHBOARD β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Vulnerability Status β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Critical: 3 β οΈ (β 2 from last week) β β
β β High: 12 β οΈ (β 3 from last week) β β
β β Medium: 45 βΉοΈ β β
β β Low: 128 βΉοΈ β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β
β Mean Time to Remediate β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Critical: 5 days β
(Target: < 7) β β
β β High: 18 days β
(Target: < 30) β β
β β Medium: 45 days β οΈ (Target: < 60) β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β
β Security Scan Coverage β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β SAST: 87% β
β β
β β SCA: 100% β
β β
β β DAST: 75% β οΈ β β
β β Container: 100% β
β β
β βββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ
Best Practices
1. Shift Security Left
- Integrate security early in SDLC
- Provide security training to developers
- Use IDE security plugins
- Implement pre-commit hooks
2. Automate Everything
- Automated security scanning in CI/CD
- Automated vulnerability management
- Automated compliance checks
- Infrastructure as code
3. Defense in Depth
- Multiple layers of security controls
- Assume each layer can be breached
- Redundant security mechanisms
- Principle of least privilege
4. Continuous Monitoring
- Real-time security monitoring
- Automated alerting
- Log aggregation and analysis
- Threat intelligence integration
5. Fail Securely
- Secure defaults
- Fail closed, not open
- Error messages don't leak information
- Graceful degradation
6. Security as Code
- Policy as code
- Automated compliance testing
- Version controlled security configs
- Immutable infrastructure
7. Regular Testing
- Automated security testing
- Penetration testing
- Red team exercises
- Chaos engineering for security
8. Incident Response Preparedness
- Documented incident response plan
- Regular drills and tabletop exercises
- Clear escalation procedures
- Post-incident reviews
9. Supply Chain Security
- Verify software provenance
- Sign and verify artifacts
- SBOM (Software Bill of Materials)
- Dependency pinning and updates
10. Security Culture
- Security champions program
- Regular security training
- Blameless post-mortems
- Security metrics visibility
Common Security Vulnerabilities
OWASP Top 10 (2021)
A01:2021 β Broken Access Control
Prevention:
- Implement proper authorization checks
- Deny by default
- Test access controls thoroughly
- Log access control failures
A02:2021 β Cryptographic Failures
Prevention:
- Use strong encryption (AES-256, RSA-2048+)
- Implement TLS 1.3
- Secure key management
- Don't store sensitive data unnecessarily
A03:2021 β Injection
Prevention:
- Use parameterized queries
- Validate and sanitize input
- Use ORM frameworks
- Implement WAF
A04:2021 β Insecure Design
Prevention:
- Threat modeling
- Secure design patterns
- Security requirements in user stories
- Security architecture review
A05:2021 β Security Misconfiguration
Prevention:
- Automated configuration management
- Remove default credentials
- Disable unnecessary features
- Regular security audits
A06:2021 β Vulnerable and Outdated Components
Prevention:
- Dependency scanning
- Regular updates
- Remove unused dependencies
- Monitor CVE databases
A07:2021 β Identification and Authentication Failures
Prevention:
- Multi-factor authentication
- Strong password policies
- Session management
- Rate limiting
A08:2021 β Software and Data Integrity Failures
Prevention:
- Digital signatures
- Verify integrity of updates
- Secure CI/CD pipeline
- Supply chain security
A09:2021 β Security Logging and Monitoring Failures
Prevention:
- Comprehensive logging
- Real-time monitoring
- Automated alerting
- Log protection
A10:2021 β Server-Side Request Forgery (SSRF)
Prevention:
- Input validation
- Network segmentation
- Whitelist allowed destinations
- Disable unused URL schemas
When to Use This Skill
Use the DevSecOps skill when you need to:
- β Implement security in CI/CD pipelines
- β Set up vulnerability scanning
- β Configure container security
- β Manage secrets securely
- β Implement compliance controls
- β Design secure architectures
- β Respond to security incidents
- β Perform security code reviews
- β Set up security monitoring
- β Automate security testing
- β Implement zero trust architecture
- β Secure cloud infrastructure
- β Configure authentication/authorization
- β Implement encryption
- β Conduct threat modeling
Examples
Example 1: Setting Up Security Pipeline
Request: "Set up a complete security scanning pipeline for a Python FastAPI application"
Response:
# .github/workflows/security.yml
name: Security Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * 0' # Weekly scan
jobs:
secret-scanning:
name: Secret Detection
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Gitleaks Scan
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dependency-scanning:
name: Dependency Vulnerabilities
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install safety pip-audit
- name: Safety Check
run: safety check --json > safety-report.json
continue-on-error: true
- name: Pip Audit
run: pip-audit --format json > pip-audit-report.json
- name: Snyk Test
uses: snyk/actions/python@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
sast-scanning:
name: Static Code Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bandit Security Scan
run: |
pip install bandit[toml]
bandit -r . -f json -o bandit-report.json
- name: Semgrep Scan
uses: returntocorp/semgrep-action@v1
with:
config: >-
p/python
p/owasp-top-ten
p/security-audit
container-scanning:
name: Container Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker Image
run: docker build -t myapp:${{ github.sha }} .
- name: Trivy Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: myapp:${{ github.sha }}
format: 'sarif'
severity: 'CRITICAL,HIGH'
exit-code: '1'
- name: Grype Scan
uses: anchore/scan-action@v3
with:
image: myapp:${{ github.sha }}
fail-build: true
severity-cutoff: high
api-security-testing:
name: DAST - API Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Start Application
run: |
docker-compose up -d
sleep 10
- name: OWASP ZAP API Scan
uses: zaproxy/[email protected]
with:
target: 'http://localhost:8000/openapi.json'
fail_action: true
- name: Stop Application
run: docker-compose down
security-report:
name: Generate Security Report
needs: [secret-scanning, dependency-scanning, sast-scanning, container-scanning]
runs-on: ubuntu-latest
steps:
- name: Collect Results
run: echo "Security scans completed"
- name: Post to Slack
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Security scan completed for ${{ github.repository }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Example 2: Kubernetes Security Hardening
Request: "Harden Kubernetes deployment for production"
Response provided in examples folder (see EXAMPLES.md)
Example 3: Implementing Secrets Management
Request: "Set up secure secrets management with HashiCorp Vault"
Response provided in examples folder (see EXAMPLES.md)
Resources
Tools
SAST:
- SonarQube, Checkmarx, Veracode, Semgrep, CodeQL
SCA:
- Snyk, Dependabot, WhiteSource, Black Duck, OWASP Dependency-Check
DAST:
- OWASP ZAP, Burp Suite, Acunetix, Netsparker
Container Security:
- Trivy, Clair, Anchore, Aqua Security, Sysdig
IaC Security:
- Checkov, tfsec, Terrascan, Snyk IaC
Secrets Management:
- HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, CyberArk
Standards & Frameworks
- OWASP Top 10
- OWASP ASVS (Application Security Verification Standard)
- NIST Cybersecurity Framework
- CIS Benchmarks
- ISO 27001
- SOC 2
- PCI-DSS
Learning Resources
Note: Security is everyone's responsibility. This skill provides guidance, but always consult security professionals for critical systems and stay updated with the latest threats and mitigation strategies.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.