Enhanced security with OWASP Top 10, vulnerability scanning, and compliance checks.
RiskCategoryMitigationInjectionA03:2021Parameterized queriesBroken AuthA07:2021MFA, secure sessionXSSA03:2021Input validation, output encodingSSRFA10:2021Input validation, allowlistsSecurity MisconfigA05:2021Secure defaults, hardening
markdown
# Prevention
- Deny by default
- Implement RBAC/ABAC
- Validate permissions server-side
- Log access control failures
- Rate limit API access
markdown
# Prevention
- Use strong algorithms (AES-256, RSA-2048+)
- Never store passwords in plaintext
- Use bcrypt/argon2 for password hashing
- Encrypt data at rest and in transit
- Manage keys properly
markdown
# Prevention
- Use parameterized queries
- Validate and sanitize input
- Use ORM/ODM libraries
- Escape output
- Use LIMIT and other SQL controls
markdown
# Prevention
- Threat modeling
- Secure design patterns
- Reference architecture
- Security requirements
- Secure development lifecycle
markdown
# Prevention
- Secure defaults
- Minimal installation
- Review configurations
- Automated verification
- Hardening guides
markdown
# Prevention
- Dependency scanning
- Automated updates
- Software composition analysis
- Monitor CVEs
- Remove unused dependencies
markdown
# Prevention
- Multi-factor authentication
- Secure password storage
- Rate limiting
- Session management
- Account lockout
markdown
# Prevention
- Digital signatures
- CI/CD pipeline security
- Dependency verification
- Code review
- Integrity checks
markdown
# Prevention
- Log security events
- Centralized logging
- Alert on suspicious activity
- Log integrity protection
- Incident response plan
markdown
# Prevention
- Input validation
- URL allowlists
- Disable HTTP redirections
- Segment networks
- Use metadata endpoints
bash
# SonarQube
sonar-scanner
# Semgrep
semgrep scan --config=auto
# Bandit (Python)
bandit -r src/
bash
# OWASP ZAP
docker run -t owasp/zap2docker-stable zap-baseline.py -t https://example.com
# Nikto
nikto -h https://example.com
bash
# npm audit
npm audit
npm audit fix
# Snyk
npx snyk test
npx snyk monitor
# Safety (Python)
safety check
# Bundler-audit (Ruby)
bundle-audit check --update
bash
# Install pre-commit
pip install pre-commit
# Add to .pre-commit-config.yaml
repos:
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
bash
# detect-secrets
detect-secrets scan
# gitleaks
gitleaks detect --source . --verbose
# truffleHog
trufflehog git file://. --only-verified
markdown
# Common patterns to detect
- AWS keys: AKIA[0-9A-Z]{16}
- GitHub tokens: gh[pousr]_[A-Za-z0-9]{36}
- Private keys: -----BEGIN.*PRIVATE KEY-----
- API keys: [a-zA-Z0-9]{32,}
- Passwords: password\s*[:=]\s*[^\s]+
markdown
# Requirements
- Data minimization
- Purpose limitation
- Storage limitation
- Right to erasure
- Data portability
- Consent management
markdown
# Requirements
- Access controls
- Audit controls
- Integrity controls
- Transmission security
- Encryption at rest
- Business associate agreements
markdown
# Trust Service Criteria
- Security
- Availability
- Processing integrity
- Confidentiality
- Privacy
markdown
# SSH
- Disable root login
- Use key-based auth
- Change default port
- Limit SSH users
# Firewall
- Allow only necessary ports
- Rate limit connections
- Block known malicious IPs
# Updates
- Enable automatic security updates
- Remove unused packages
- Disable unnecessary services
markdown
# Headers
- Content-Security-Policy
- X-Content-Type-Options
- X-Frame-Options
- Strict-Transport-Security
# Cookies
- Secure flag
- HttpOnly flag
- SameSite attribute
- Short expiration
# Input Validation
- Whitelist validation
- Length limits
- Type checking
- Sanitization
markdown
# Access
- Least privilege
- Separate accounts
- Strong passwords
- Network restrictions
# Configuration
- Disable remote access
- Enable encryption
- Audit logging
- Regular backups
# Queries
- Parameterized queries
- Input validation
- Output encoding
CategoryToolPurposeSASTSonarQube, SemgrepCode analysisDASTOWASP ZAP, NiktoRuntime testingDependenciesSnyk, npm auditVulnerability scanningSecretsdetect-secrets, gitleaksCredential detectionContainerTrivy, ClairImage scanningInfrastructureCheckov, tfsecIaC scanning