41 pages ยท 8 sections
Ctrl K
GitHub Portfolio

SecOps Overview

SecOps (Security Operations) integrates security practices into the entire software development lifecycle, enabling teams to deliver secure software at velocity without sacrificing agility for protection.

DevSecOps Principles

DevSecOps represents the cultural and technical evolution of embedding security into every phase of the software development lifecycle. The shift-left security philosophy moves security checks earlier in the pipeline, where vulnerabilities are exponentially cheaper to fix.

Shift-Left Security

Traditional security models perform assessments late in the lifecycle โ€” often just before production. Shift-left security inverts this model:

PhaseSecurity ActivityTools
PlanningThreat modeling, security requirementsMicrosoft Threat Modeling Tool, OWASP Threat Dragon
DevelopmentSecure coding standards, SAST, secrets scanningSonarQube, GitLeaks, ESLint Security
BuildDependency scanning, SCA, license complianceSnyk, OWASP Dependency-Check, FOSSA
TestDAST, fuzzing, penetration testingOWASP ZAP, Burp Suite, AFL++
DeployContainer scanning, IaC scanningTrivy, Checkov, tfsec
OperateRuntime protection, EDR, SIEMWazuh, Falco, Splunk

Core Principles

  1. Security as Code โ€” Security policies expressed as version-controlled code (Open Policy Agent, Sentinel)
  2. Automated Security Gates โ€” Pipeline-enforced quality gates that block on critical findings
  3. Continuous Monitoring โ€” Real-time visibility into security posture across all environments
  4. Shared Responsibility โ€” Security is everyone's responsibility, not a siloed team
  5. Rapid Feedback โ€” Developers receive security feedback within minutes, not weeks

Security in CI/CD Pipeline Stages

A secure CI/CD pipeline implements multiple verification layers. Each stage must fail the pipeline when critical security issues are detected:

# Example: Secure CI/CD Pipeline Structure
# .github/workflows/secure-pipeline.yml

stages:
  - precommit    # Git hooks, linting
  - build        # SAST, SCA, secrets scan
  - test         # Unit tests, DAST
  - container    # Image scanning, SBOM generation
  - deploy       # IaC scanning, compliance checks
  - monitor      # Runtime security, anomaly detection

security-gates:
  sast-critical:     block-on > 0 critical findings
  secrets-scan:      block-on any leaked secret
  dependency-cvss:   block-on CVSS >= 7.0
  container-cve:     block-on CVE severity = CRITICAL
  compliance-drift:  block-on policy violation

Pipeline Security Controls

ControlImplementationGate Criteria
Branch ProtectionRequired PR reviews, signed commits2+ approvals, all checks pass
Secrets DetectionGitLeaks + TruffleHog in CIZero leaked secrets
SASTSonarQube, Semgrep0 critical, <5 high per PR
SCASnyk, DependabotNo CVE >= 7.0 unremediated
Container ScanTrivy, Clair0 critical CVEs in base image
IaC ScanCheckov, tfsec0 high-severity misconfigurations

Defense in Depth Strategy

Defense in depth is a layered security architecture where multiple independent controls protect assets. If one layer fails, subsequent layers provide continued protection:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Layer 7: Data Encryption (at rest/transit) โ”‚
โ”‚  Layer 6: Application Security (WAF, RASP)  โ”‚
โ”‚  Layer 5: Endpoint Protection (EDR, FIM)    โ”‚
โ”‚  Layer 4: Network Security (SG, NACL, IDS)  โ”‚
โ”‚  Layer 3: Compute Security (Hardened AMIs)   โ”‚
โ”‚  Layer 2: Access Control (IAM, RBAC, MFA)    โ”‚
โ”‚  Layer 1: Perimeter (CDN, DDoS protection)   โ”‚
โ”‚  Layer 0: Physical/Cloud Provider Security   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Layer Implementation

Cloud-Native Defense in Depth

Each cloud provider offers native controls for every layer. The key is implementing all layers with automation โ€” manual security configuration drifts and fails.

LayerAWS ControlsAzure ControlsGCP Controls
PerimeterCloudFront, Shield AdvancedFront Door, DDoS ProtectionCloud CDN, Cloud Armor
Access ControlIAM, Organizations SCPsAzure AD RBAC, PoliciesIAM, Organization Policies
ComputeSystems Manager, InspectorDefender for CloudOS Login, Shielded VMs
NetworkVPC, Security Groups, NACLsNSGs, ASGs, FirewallVPC Firewall, Cloud NAT
EndpointWazuh, CrowdStrikeMicrosoft DefenderChronicle, Wazuh
ApplicationWAF v2, AWS RUMApplication Gateway WAFCloud Armor reCAPTCHA
DataKMS, MacieKey Vault, PurviewCMEK, DLP API

Security Frameworks

NIST Cybersecurity Framework

The NIST CSF organizes cybersecurity activities into five core functions:

  1. Identify โ€” Asset management, risk assessment, governance
  2. Protect โ€” Access control, awareness training, data security
  3. Detect โ€” Anomaly detection, continuous monitoring
  4. Respond โ€” Response planning, communications, analysis
  5. Recover โ€” Recovery planning, improvements, communications

CIS Controls

The CIS Controls (v8) provide 18 prioritized safeguards:

ControlTitleImplementation Group 1
CIS 1Inventory and Control of Enterprise AssetsRequired
CIS 2Inventory and Control of Software AssetsRequired
CIS 3Data ProtectionRequired
CIS 4Secure Configuration of Enterprise AssetsRequired
CIS 5Account ManagementRequired
CIS 6Access Control ManagementRequired
CIS 7Continuous Vulnerability ManagementRequired
CIS 8Audit Log ManagementRequired
CIS 9Email and Web Browser ProtectionsRequired
CIS 10Malware DefensesRequired

OWASP Top 10 (2021)

RankVulnerabilityMitigation Strategy
A01Broken Access ControlRBAC enforcement, principle of least privilege
A02Cryptographic FailuresEncryption at rest/transit, key rotation
A03Injection (SQL, NoSQL, Command)Parameterized queries, input validation
A04Insecure DesignThreat modeling, secure design patterns
A05Security MisconfigurationHardened images, IaC scanning, drift detection
A06Vulnerable ComponentsDependency scanning, SBOM, automated patching
A07Identification and Authentication FailuresMFA, session management, password policy
A08Software and Data Integrity FailuresCode signing, supply chain verification
A09Security Logging FailuresCentralized logging, tamper-proof audit trails
A10Server-Side Request ForgeryURL validation, network segmentation

Threat Modeling Basics

STRIDE Methodology

STRIDE is a threat classification framework developed by Microsoft. Each letter represents a category of threat:

ThreatProperty ViolatedExampleMitigation
SpoofingAuthenticationStolen credentials, session hijackingMFA, token binding, rate limiting
TamperingIntegrityData modification in transit/storageDigital signatures, HMAC, TLS
RepudiationNon-repudiationUser denies performing an actionAudit logging, signed logs
Information DisclosureConfidentialityData breach, error message leakageEncryption, access controls
Denial of ServiceAvailabilityDDoS, resource exhaustionRate limiting, WAF, auto-scaling
Elevation of PrivilegeAuthorizationHorizontal/vertical privilege escalationRBAC, input validation, least privilege

Threat Modeling Process

  1. Define Scope โ€” Identify the application, data flows, and trust boundaries
  2. Decompose Application โ€” Create Data Flow Diagrams (DFDs) showing processes, data stores, external entities
  3. Identify Threats โ€” Apply STRIDE to each element in the DFD
  4. Assess Risks โ€” Rate likelihood and impact for each identified threat
  5. Plan Mitigations โ€” Design and implement controls for high-risk threats
  6. Validate โ€” Re-assess after mitigations are implemented
# threat_model_risk_calculator.py
# Risk scoring for identified threats

def calculate_risk(likelihood: int, impact: int) -> str:
    """
    Calculate risk level based on 1-5 likelihood and impact scores.
    
    Returns: CRITICAL, HIGH, MEDIUM, LOW
    """
    score = likelihood * impact
    
    if score >= 15:
        return "CRITICAL"
    elif score >= 10:
        return "HIGH"
    elif score >= 5:
        return "MEDIUM"
    else:
        return "LOW"

# Example: SQL injection in authentication endpoint
likelihood = 4   # Easily exploitable with known tools
impact = 5       # Full database compromise
risk = calculate_risk(likelihood, impact)
print(f"SQL Injection Risk Level: {risk}")  # CRITICAL

# Example: Information disclosure via verbose error messages
likelihood = 3   # Requires some reconnaissance
impact = 2       # Limited information leakage
risk = calculate_risk(likelihood, impact)
print(f"Info Disclosure Risk Level: {risk}")  # MEDIUM

Security Tools Landscape

CategoryOpen SourceCommercialCloud Native
Secrets ManagementHashiCorp Vault, Mozilla SOPS1Password, CyberArkAWS Secrets Manager, Azure Key Vault
SASTSonarQube Community, Semgrep, BanditCheckmarx, Veracode, SonarQube EnterpriseAmazon CodeGuru, Azure DevOps Security
DASTOWASP ZAP, NiktoBurp Suite, NetsparkerAWS Inspector (agentless)
SCAOWASP Dependency-Check, Snyk (free tier)Snyk, Black Duck, MendAWS Inspector + Amazon Inspector
Container ScanningTrivy, Clair, GrypeAqua, Prisma CloudAmazon ECR scanning, Azure Defender
EDR/XDRWazuh, OsqueryCrowdStrike, SentinelOneAmazon GuardDuty, Azure Sentinel
IaC ScanningCheckov, tfsec, terrascanPrisma Cloud, Snyk IaCAWS Config, Azure Policy
SIEMWazuh, Elastic SIEM, GraylogSplunk, QRadar, SentinelAmazon Security Lake, Chronicle
CSPMProwler, ScoutSuite, CloudSploitDome9, Prisma CloudAWS Security Hub, Azure Security Center
Secrets ScanningGitLeaks, TruffleHog, detect-secretsGitGuardian, NightfallGitHub secret scanning, AWS CodeCommit

Vulnerability Management Lifecycle

Vulnerability management is a continuous cyclical process:

  1. Discover โ€” Asset inventory, network scanning, agent-based detection
  2. Assess โ€” Vulnerability scanning with authenticated and unauthenticated tests
  3. Prioritize โ€” Risk-based scoring using CVSS, threat intelligence, asset criticality
  4. Remediate โ€” Patching, configuration hardening, compensating controls
  5. Verify โ€” Rescanning to confirm remediation, regression testing
  6. Report โ€” Executive dashboards, compliance evidence, trend analysis
# vulnerability-management-sla.yaml
# SLA targets by severity

severities:
  critical:
    cvss_range: "9.0 - 10.0"
    remediation_sla: "24 hours"
    approval_required: false  # Emergency patching
    auto_create_ticket: true
    
  high:
    cvss_range: "7.0 - 8.9"
    remediation_sla: "7 days"
    approval_required: true
    auto_create_ticket: true
    
  medium:
    cvss_range: "4.0 - 6.9"
    remediation_sla: "30 days"
    approval_required: true
    auto_create_ticket: true
    
  low:
    cvss_range: "0.1 - 3.9"
    remediation_sla: "90 days"
    approval_required: false
    auto_create_ticket: false

exemptions:
  process: "CISO approval required for >30 day extensions"
  max_extension: "90 days"
  review_frequency: "Monthly"

Security Metrics and KPIs

Effective SecOps programs measure leading indicators (process metrics) and lagging indicators (outcome metrics):

MetricTypeTargetMeasurement
Mean Time to Remediate (MTTR)Lagging< 24h critical, < 7d highVulnerability scanner data
Security Test CoverageLeading> 90% of reposCI/CD pipeline instrumentation
Secrets Leaked in ProductionLagging0Secrets scanner + incident tracking
Deployment Frequency with Security GatesLeading100%Pipeline configuration audit
Phishing Click RateLagging< 5%Phishing simulation platform
Mean Time to Detect (MTTD)Lagging< 1 hourSIEM alert metrics
Code Review Security CommentsLeading> 10% of reviewsPR analysis
Container Image Scan Pass RateLeading> 95%Container scanner reports

Security Champion Program

A Security Champion program embeds security expertise within development teams without requiring dedicated security headcount per team.

Program Structure

Security Champion Program
โ”‚
โ”œโ”€โ”€ Executive Sponsor (CISO / VP Engineering)
โ”‚
โ”œโ”€โ”€ Security Champion Lead (Security Team)
โ”‚   โ”œโ”€โ”€ Onboarding curriculum
โ”‚   โ”œโ”€โ”€ Monthly training sessions
โ”‚   โ””โ”€โ”€ Office hours support
โ”‚
โ”œโ”€โ”€ Champions (1 per dev team ~10:1 ratio)
โ”‚   โ”œโ”€โ”€ Attend monthly meetings
โ”‚   โ”œโ”€โ”€ Review security requirements
โ”‚   โ”œโ”€โ”€ Escalate issues to security team
โ”‚   โ””โ”€โ”€ Advocate for secure practices
โ”‚
โ””โ”€โ”€ Incentives
    โ”œโ”€โ”€ Conference attendance budget
    โ”œโ”€โ”€ Certification reimbursement (OSCP, CISSP)
    โ”œโ”€โ”€ Recognition in performance reviews
    โ””โ”€โ”€ Dedicated learning time (10% allocation)

Champion Responsibilities

  • Participate in threat modeling sessions for their team's features
  • Review security-related pull requests
  • Ensure team compliance with security policies
  • Report security metrics to the security team monthly
  • Drive adoption of security tools and practices within their team

Lean Six Sigma Application

Apply DMAIC (Define, Measure, Analyze, Improve, Control) to security processes. Measure baseline MTTR, analyze bottlenecks in the vulnerability remediation workflow, implement process improvements, and control with automated enforcement in CI/CD.

Compliance Mapping

Organizations often need to satisfy multiple compliance frameworks simultaneously. Cross-mapping controls reduces audit burden:

Control DomainSOC 2 CCISO 27001PCI-DSS v4CIS Control
Access ControlCC6.1, CC6.2A.9.1, A.9.2, A.9.47.1, 7.2, 8.2, 8.3CIS 5, CIS 6
Change ManagementCC8.1A.12.1.2, A.14.2.26.3, 6.5CIS 4
EncryptionCC6.1, CC6.7A.10.1, A.10.24.1, 4.2CIS 3
Logging & MonitoringCC7.2, CC7.3A.12.410.2, 10.3, 11.4CIS 8
Vulnerability ManagementCC7.1, CC8.1A.12.6, A.18.26.3, 11.3CIS 7
Incident ResponseCC4.1, CC7.4, CC7.5A.16.112.10CIS 17, CIS 18
Vendor ManagementCC9.1, CC9.2A.15.1, A.15.212.8CIS 15
Data ClassificationCC6.1, CC6.7A.8.2, A.8.33.1, 3.2CIS 3
Network SecurityCC6.6, CC6.7A.13.11.2, 1.3, 2.1CIS 4, CIS 12, CIS 13
Backup & RecoveryA1.2, A1.3A.12.3, A.17.112.3, 12.4CIS 11

Compliance is Not Security

Compliance frameworks establish minimum baselines. A fully compliant organization can still be breached. Use compliance as a foundation, not a ceiling. Continuous security monitoring and threat-informed defense go beyond checklist compliance.

Evidence Collection Automation

Automate evidence collection for compliance audits using infrastructure-as-code and continuous monitoring:

# terraform/compliance-evidence-collection.tf
# Automated evidence collection for SOC 2

# AWS Config Rule: Check for encrypted volumes
resource "aws_config_config_rule" "ec2_encrypted_volumes" {
  name = "ec2-volumes-must-be-encrypted"
  
  source {
    owner             = "AWS"
    source_identifier = "EC2_VOLUME_INUSE_CHECK"
  }
  
  input_parameters = jsonencode({
    volumeIds = ""
  })
  
  depends_on = [aws_config_configuration_recorder.compliance_recorder]
}

# AWS Config Rule: MFA enabled for root
resource "aws_config_config_rule" "root_account_mfa_enabled" {
  name = "root-account-mfa-enabled"
  
  source {
    owner             = "AWS"
    source_identifier = "ROOT_ACCOUNT_MFA_ENABLED"
  }
  
  depends_on = [aws_config_configuration_recorder.compliance_recorder]
}

# CloudWatch Log Group for audit trail
resource "aws_cloudwatch_log_group" "audit_logs" {
  name              = "/compliance/audit-trail"
  retention_in_days = 2555  # 7 years for SOX/PCI-DSS
  
  kms_key_id = aws_kms_key.audit_encryption.arn
}

Related Topics