Security Development Practices | Shift-Left DevSecOps
Integrate security into SDLC with SAST, dependency scanning, and threat modeling. GitScrum tracks vulnerabilities by severity with 24h to 90d SLAs.
6 min read
Security is everyone's responsibility, not just the security team's. Good security practices are built into development workflows, not bolted on at the end. This guide covers practical security practices for development teams.
Security in SDLC
| Phase | Security Activity |
|---|---|
| Design | Threat modeling |
| Code | Secure coding, review |
| Build | SAST, dependency scan |
| Test | DAST, pen testing |
| Deploy | Container scan, secrets |
| Run | Monitoring, patching |
Secure Coding
Development Practices
SECURE CODING
βββββββββββββ
INPUT VALIDATION:
βββββββββββββββββββββββββββββββββββββ
Always validate:
βββ User input
βββ API parameters
βββ File uploads
βββ Headers
βββ Never trust input
βββ Whitelist over blacklist
Example:
// Bad
const userId = req.params.id;
db.query(`SELECT * FROM users WHERE id = ${userId}`);
// Good
const userId = parseInt(req.params.id, 10);
if (isNaN(userId)) throw new Error('Invalid ID');
db.query('SELECT * FROM users WHERE id = ?', [userId]);
OUTPUT ENCODING:
βββββββββββββββββββββββββββββββββββββ
βββ HTML encode for HTML context
βββ URL encode for URLs
βββ SQL parameterize for queries
βββ Context-aware encoding
βββ Prevent injection
AUTHENTICATION:
βββββββββββββββββββββββββββββββββββββ
βββ Use proven libraries
βββ Strong password requirements
βββ Rate limiting on login
βββ Secure session management
βββ MFA where appropriate
βββ Don't roll your own
AUTHORIZATION:
βββββββββββββββββββββββββββββββββββββ
βββ Check on every request
βββ Server-side enforcement
βββ Principle of least privilege
βββ Don't rely on client
βββ Explicit access control
SECRETS MANAGEMENT:
βββββββββββββββββββββββββββββββββββββ
βββ Never in code
βββ Environment variables
βββ Secret managers (Vault, AWS Secrets)
βββ Rotate regularly
βββ Different per environment
βββ Protected secrets
Code Review
Security Focus
SECURITY CODE REVIEW
ββββββββββββββββββββ
REVIEW CHECKLIST:
βββββββββββββββββββββββββββββββββββββ
For every PR:
βββ β Input validation present
βββ β No hardcoded secrets
βββ β SQL parameterized
βββ β Auth checks in place
βββ β Sensitive data protected
βββ β Error handling secure
βββ β Logging sanitized
βββ Security-conscious review
RED FLAGS:
βββββββββββββββββββββββββββββββββββββ
Watch for:
βββ String concatenation in queries
βββ eval() or similar
βββ Hardcoded passwords/keys
βββ Missing auth checks
βββ Disabled security controls
βββ Overly permissive CORS
βββ Sensitive data in logs
βββ Known bad patterns
AUTOMATED CHECKS:
βββββββββββββββββββββββββββββββββββββ
CI/CD gates:
βββ SAST scan
βββ Dependency check
βββ Secret detection
βββ Block on critical findings
βββ Automated first line
βββ Human review second
CI/CD Security
Pipeline Security
CI/CD SECURITY
ββββββββββββββ
SECURITY PIPELINE:
βββββββββββββββββββββββββββββββββββββ
Push
β
βΌ
βββββββββββββββββββ
β Secret Detectionβ GitGuardian, TruffleHog
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β SAST Analysis β SonarQube, Snyk
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Dependency Scan β npm audit, Snyk
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Container Scan β Trivy, Clair
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Build & Deploy β
βββββββββββββββββββ
SAST (STATIC ANALYSIS):
βββββββββββββββββββββββββββββββββββββ
Scan code for vulnerabilities:
βββ SQL injection patterns
βββ XSS vulnerabilities
βββ Insecure crypto
βββ Hardcoded secrets
βββ Early detection
βββ Every PR
DEPENDENCY SCANNING:
βββββββββββββββββββββββββββββββββββββ
Check for known vulnerabilities:
βββ npm audit
βββ Snyk
βββ Dependabot
βββ Block on critical CVEs
βββ Auto-update patches
βββ Supply chain security
SECRET DETECTION:
βββββββββββββββββββββββββββββββββββββ
Find leaked secrets:
βββ Pre-commit hooks
βββ CI/CD scanning
βββ Git history scanning
βββ Alert on detection
βββ Block commits
βββ Prevent leaks
POLICY GATES:
βββββββββββββββββββββββββββββββββββββ
Block deploys when:
βββ Critical vulnerabilities
βββ Secrets detected
βββ High-severity findings
βββ No exceptions
βββ Enforce standards
Vulnerability Management
Handling Findings
VULNERABILITY MANAGEMENT
ββββββββββββββββββββββββ
TRIAGE:
βββββββββββββββββββββββββββββββββββββ
For each finding:
βββ Is it real? (not false positive)
βββ Is it exploitable?
βββ What's the impact?
βββ Assign severity
βββ Prioritize response
SEVERITY LEVELS:
βββββββββββββββββββββββββββββββββββββ
Critical:
βββ Actively exploited
βββ Remote code execution
βββ Data breach risk
βββ SLA: 24 hours
βββ Drop everything
High:
βββ Significant risk
βββ Authentication bypass
βββ Privilege escalation
βββ SLA: 7 days
βββ High priority
Medium:
βββ Moderate risk
βββ Limited impact
βββ Requires user action
βββ SLA: 30 days
βββ Normal priority
Low:
βββ Minor risk
βββ Defense in depth
βββ Best practice
βββ SLA: 90 days
βββ Backlog
TRACKING:
βββββββββββββββββββββββββββββββββββββ
Track like bugs:
βββ Create task in GitScrum
βββ Label: security
βββ Severity field
βββ SLA deadline
βββ Assigned owner
βββ Visible accountability
Threat Modeling
Design Security
THREAT MODELING
βββββββββββββββ
WHEN TO MODEL:
βββββββββββββββββββββββββββββββββββββ
βββ New features
βββ Architecture changes
βββ Third-party integrations
βββ Sensitive data handling
βββ During design phase
βββ Before coding
STRIDE MODEL:
βββββββββββββββββββββββββββββββββββββ
Spoofing: Can someone pretend to be someone else?
Tampering: Can data be modified maliciously?
Repudiation: Can actions be denied?
Information Disclosure: Can data leak?
Denial of Service: Can service be disrupted?
Elevation of Privilege: Can access be escalated?
SIMPLE APPROACH:
βββββββββββββββββββββββββββββββββββββ
For each feature ask:
βββ What can go wrong?
βββ Who are the attackers?
βββ What are the assets?
βββ What are the controls?
βββ Document threats
βββ Mitigate in design
DOCUMENT FINDINGS:
βββββββββββββββββββββββββββββββββββββ
Feature: User profile API
Threat: Unauthorized access to profiles
Control: Authentication required
Threat: IDOR (access other profiles)
Control: Authorization check on profile ID
GitScrum Integration
Security Tracking
GITSCRUM FOR SECURITY
βββββββββββββββββββββ
SECURITY LABELS:
βββββββββββββββββββββββββββββββββββββ
βββ security
βββ vulnerability
βββ severity:critical
βββ severity:high
βββ severity:medium
βββ severity:low
βββ Clear categorization
SECURITY TASKS:
βββββββββββββββββββββββββββββββββββββ
Task: "Fix SQL injection in search API"
βββ Severity: Critical
βββ SLA: 24 hours
βββ CVE reference (if any)
βββ Affected versions
βββ Fix approach
βββ Complete information
TRACKING METRICS:
βββββββββββββββββββββββββββββββββββββ
βββ Open vulnerabilities by severity
βββ SLA compliance
βββ Time to remediation
βββ Findings over time
βββ Trend visibility
βββ Improvement tracking
DOCUMENTATION:
βββββββββββββββββββββββββββββββββββββ
NoteVault:
βββ Security standards
βββ Secure coding guidelines
βββ Incident response plan
βββ Threat models
βββ Security knowledge base
Best Practices
For Security Development
Anti-Patterns
SECURITY MISTAKES:
β Security as afterthought
β Ignoring scan results
β No vulnerability SLAs
β Secrets in code
β Missing input validation
β Rolling own crypto
β Assuming trust
β Security by obscurity