DevSecOps in 2025: Shift-Left Security with Terraform, Checkov, and Trivy
Published December 2, 2025 • 14 min read
Introduction: Security as Code in a High-Threat Environment
For Israeli companies, cybersecurity is not hypothetical; it is a daily reality. The geopolitical landscape combined with the global rise in ransomware and state-sponsored attacks makes security a top priority. However, traditional security models—based on perimeter firewalls and manual audits—are incompatible with the speed of modern DevOps.
HostingX IL champions the DevSecOps methodology, where security is integrated into the infrastructure code itself. By utilizing Terraform, we ensure that security is consistent, automated, and "shifted left" to the earliest stages of development—catching vulnerabilities before they reach production.
According to recent industry data, 95% of cloud security breaches are caused by misconfigurations, not sophisticated zero-day exploits. This means the majority of security incidents are preventable through proper Infrastructure as Code practices and automated scanning.
The Prevalence of Misconfiguration
The vast majority of cloud security breaches are not caused by zero-day exploits but by simple misconfigurations:
- An S3 bucket left open to the public, exposing customer PII
- A security group allowing SSH from 0.0.0.0/0 (the entire internet)
- An unencrypted RDS database storing payment information
- IAM roles with overly permissive policies (e.g., "s3:*" on all buckets)
- Security logs not enabled or not retained long enough for forensics
In a manual environment, these errors are easy to make and hard to spot. In a Terraform environment, they can be detected automatically before deployment. HostingX IL integrates Static Application Security Testing (SAST) tools specifically designed for IaC into the CI/CD pipeline.
This means that a security vulnerability is treated exactly like a syntax error—it breaks the build and prevents deployment, forcing remediation before code reaches production.
Tooling Comparison: Checkov, Trivy, and Tfsec
The ecosystem for Terraform security scanning has matured significantly. HostingX IL leverages best-in-class tools to provide comprehensive coverage:
IaC Security Tool Comparison:
| Feature | Checkov | Trivy |
|---|---|---|
| Scope | Multi-IaC (Terraform, K8s, CloudFormation) | All-in-one (Container, FS, IaC) |
| Custom Policies | Python-based custom checks | Rego (OPA) based policies |
| Integration | CI/CD, VS Code, Pre-commit | CI/CD, IDE, CLI |
| Compliance | Built-in SOC 2, HIPAA, CIS | Built-in CIS, NIST |
| HostingX IL Strategy | Primary IaC scanner | Unified scanning (containers + IaC) |
HostingX IL Approach: We use Trivy for unified scanning of both container images and IaC code in a single tool. We develop custom Rego policies that map to specific Israeli privacy laws and industry regulations, ensuring compliance is embedded in the scanning process.
Implementing Automated Security Scanning
HostingX IL integrates security scanning at multiple points in the development lifecycle:
1. Pre-Commit Hooks (Developer Workstation)
We configure Git pre-commit hooks that run lightweight security checks before code is even pushed to the repository. This provides immediate feedback to developers, catching obvious issues like hardcoded secrets or publicly accessible S3 buckets.
# .pre-commit-config.yaml
repos:
- repo: https://github.com/aquasecurity/trivy
rev: v0.48.0
hooks:
- id: trivy-config
args: ['--severity', 'HIGH,CRITICAL']
- repo: https://github.com/bridgecrewio/checkov
rev: 3.1.0
hooks:
- id: checkov
args: ['--framework', 'terraform', '--quiet']2. Pull Request CI Pipeline (Blocking Gate)
The primary enforcement point is the Pull Request pipeline. When a developer opens a PR with Terraform changes, the CI system runs comprehensive security scans:
# GitHub Actions workflow
name: Terraform Security Scan
on: [pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy IaC scan
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'HIGH,CRITICAL'
exit-code: '1' # Fail the build on findings
- name: Upload results to GitHub Security
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
- name: Run Checkov
uses: bridgecrewio/checkov-action@master
with:
directory: ./terraform
framework: terraform
soft_fail: false # Block on failuresIf security issues are detected, the build fails and the PR cannot be merged. The results are posted as comments on the PR, showing exactly which resources are misconfigured and how to fix them.
3. Continuous Monitoring (Drift Detection)
Even with perfect CI/CD, configuration drift can occur if someone makes manual changes in the cloud console. HostingX IL implements nightly scans that check the actual live infrastructure against security policies, alerting teams to violations.
Implementing Zero Trust Architecture with Terraform
Zero Trust assumes that threats exist both inside and outside the network. The principle is: "Never trust, always verify." HostingX IL utilizes Terraform to implement the granular segmentation required for Zero Trust.
Network Micro-Segmentation
Instead of broad security groups that allow traffic between entire subnets, we use Terraform for_each loops to systematically generate Security Group rules that allow traffic only between specific service tiers on specific ports:
# Zero Trust Security Group Rules
locals {
service_communication = {
"api-to-db" = {
from_sg = aws_security_group.api.id
to_sg = aws_security_group.database.id
protocol = "tcp"
from_port = 5432
to_port = 5432
}
"frontend-to-api" = {
from_sg = aws_security_group.frontend.id
to_sg = aws_security_group.api.id
protocol = "tcp"
from_port = 443
to_port = 443
}
}
}
resource "aws_security_group_rule" "allow_specific" {
for_each = local.service_communication
type = "ingress"
security_group_id = each.value.to_sg
source_security_group_id = each.value.from_sg
protocol = each.value.protocol
from_port = each.value.from_port
to_port = each.value.to_port
description = "Allow ${each.key}"
}IAM Hardening with Least Privilege
Instead of using AWS managed policies (which are often overly permissive), HostingX IL uses Terraform aws_iam_policy_document data sources to construct exact-match permission sets for every role:
# Least Privilege IAM Policy
data "aws_iam_policy_document" "lambda_s3_access" {
statement {
effect = "Allow"
actions = [
"s3:GetObject",
"s3:PutObject"
]
resources = [
"${aws_s3_bucket.uploads.arn}/${var.function_name}/*"
]
}
statement {
effect = "Allow"
actions = ["s3:ListBucket"]
resources = [aws_s3_bucket.uploads.arn]
condition {
test = "StringLike"
variable = "s3:prefix"
values = ["${var.function_name}/*"]
}
}
}
resource "aws_iam_role_policy" "lambda" {
role = aws_iam_role.lambda.id
policy = data.aws_iam_policy_document.lambda_s3_access.json
}This ensures that a compromised Lambda function has zero ability to traverse the network or access unrelated data—it can only access its specific S3 prefix.
Secure Supply Chain Management
Security extends beyond your own code to the dependencies you consume. HostingX IL helps organizations secure their software supply chain using Terraform:
Private Module Registries
We configure Terraform to pull modules and provider plugins only from authenticated, internal registries (like Artifactory or Terraform Cloud Private Registry), preventing "dependency confusion" attacks where malicious public packages are substituted for internal ones.
# .terraformrc - Force private registry
provider_installation {
direct {
exclude = ["registry.terraform.io/*/*"]
}
network_mirror {
url = "https://terraform-registry.hostingx-internal.net"
include = ["*/*"]
}
}Container Image Signing
We integrate Terraform with tools like Cosign to verify the cryptographic signatures of container images before updating Kubernetes deployments, ensuring that only trusted code runs in production.
Real-World Security Incident Prevention
Case Study: Preventing Data Breach at Israeli HealthTech Startup
Scenario: A developer created an RDS database for a new feature without enabling encryption at rest. The database would contain patient health records (PHI) subject to HIPAA compliance.
HostingX IL Protection: Checkov detected the misconfiguration during the PR review:
Check: CKV_AWS_16: "Ensure RDS database has encryption at rest"
FAILED for resource: aws_db_instance.patient_records
File: /main.tf:45-62
45 | resource "aws_db_instance" "patient_records" {
46 | allocated_storage = 100
47 | engine = "postgres"
...
60 | # storage_encrypted = true <- MISSING
61 | }Outcome: The build failed. The developer added storage_encrypted = true before merging. The potential HIPAA violation and resulting fines (up to $1.5M) were prevented by automated scanning.
Custom Security Policies for Israeli Regulations
Israel's Privacy Protection Regulations (PPR) and sector-specific regulations (e.g., ISA for financial services) impose unique requirements. HostingX IL develops custom Checkov/Trivy policies that enforce these requirements:
- Data Residency: Policies that fail if resources are created outside IL-Central-1 (Tel Aviv) region for regulated data
- Retention Requirements: Enforcing CloudWatch Logs retention periods that meet audit requirements (typically 7 years for financial data)
- Encryption Standards: Mandating specific KMS key configurations that meet Israeli government encryption requirements
HostingX IL's Managed SecOps Service
Our SecOps & Compliance service provides an "always-on" security operations center for your infrastructure code:
- Automated Remediation: We implement "self-healing" workflows. If a threat detection system (like Amazon GuardDuty) identifies a compromised instance, an automated Lambda triggered by the alert can isolate the instance by modifying its Security Group—a process codified and managed via our security automation platform.
- Vulnerability Management: We provide dashboards that track the security posture of your Terraform state over time, helping you measure improvement and demonstrate due diligence to stakeholders.
- Incident Response Playbooks: We create Terraform-based disaster recovery and incident response playbooks that can rebuild compromised infrastructure from clean snapshots in minutes.
- Security Training: We train your development teams on secure IaC practices, transforming security from a blocker into an enabler.
Measuring Security Effectiveness
Key Security Metrics We Track:
- Mean Time to Remediate (MTTR): Average time from vulnerability detection to fix deployment (target: <24 hours)
- Security Scan Coverage: Percentage of infrastructure changes scanned before deployment (target: 100%)
- Critical Vulnerabilities Escaped to Production: Number of high/critical findings that bypassed scanning (target: 0)
- Configuration Drift: Percentage of resources modified outside IaC process (target: <2%)
- Security Policy Violations: Failed builds due to policy violations (declining trend indicates improving security awareness)
Conclusion: Security as an Accelerator
Security in 2025 is not a checkbox or a gate—it is a seamless fabric that wraps around every resource. By codifying security controls in Terraform and enforcing them via automated scanning, HostingX IL allows development teams to move fast without breaking things—or leaving the door open to attackers.
For Israeli companies operating in high-threat environments and regulated industries, DevSecOps is not optional—it is existential. The question is whether security will slow you down or speed you up. With HostingX IL, security becomes an accelerator, not a blocker.
By shifting security left to the point of code authoring and automating enforcement in the CI/CD pipeline, we ensure that every deployment is secure by design, compliant by default, and resilient by architecture.
Ready to Secure Your Infrastructure?
Let HostingX IL implement DevSecOps practices that protect your infrastructure while accelerating deployment velocity.
HostingX Solutions
Expert DevOps and automation services accelerating B2B delivery and operations.
Services
Subscribe to our newsletter
Get monthly email updates about improvements.
© 2026 HostingX Solutions LLC. All Rights Reserved.
Terms of Service
Privacy Policy
Acceptable Use Policy