Skip to content

Debasish-87/ZeroTrustOps-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Version License Go Python React Docker PostgreSQL

πŸ” ZeroTrustOps Platform

Self-Hosted DevSecOps for Kubernetes β€” Scan Every Push. Block Misconfigurations Before They Reach Production.

A self-hosted DevSecOps platform that scans every Git push and blocks security misconfigurations, hardcoded secrets, and infrastructure vulnerabilities before they reach production.

πŸš€ Quick Start Β· πŸ“– Documentation Β· πŸ›‘οΈ SecTL Engine Β· πŸ—ΊοΈ Roadmap Β· 🀝 Contributing


πŸ“Έ Screenshots

Dashboard Overview

Dashboard Overview

Real-time overview of connected repositories, scan history, and security posture at a glance.

Repository Management

Repository Management

Add, remove, and monitor repositories β€” each automatically webhook-connected to the scan pipeline.

Repositories

Per-repository scan summary with status indicators and quick-action controls.

Scan Results & Findings

Scan Dashboard

Scan history list with PASS/FAIL status, timestamps, and scan type breakdown.

Scan Results

Detailed findings view β€” rule ID, severity, file path, description, and remediation guidance per violation.

Scan Result Dashboard

High-level scan result summary grouped by severity (CRITICAL β†’ LOW) with finding counts.

Triggering a Scan

Scan Trigger

Manually trigger a scan from the dashboard, or let the GitHub webhook fire it automatically on every push.


🧭 Overview

ZeroTrustOps scans every Git push, detects misconfigurations and secrets, and blocks insecure infrastructure before it reaches production.

Powered by a custom enforcement engine (SecTL), along with Gitleaks for secrets detection, it provides an end-to-end DevSecOps pipeline with automated scanning, CI/CD enforcement, and a real-time dashboard β€” all running locally with a single command.

⚑ How it works

Every push is treated as a security checkpoint. If it fails, it never deploys.

git push
  └── GitHub webhook triggers the scan pipeline
        └── Repository is cloned into an isolated scan environment
              β”‚
              β”œβ”€β”€ πŸ” Static Analysis (SecTL)
              β”‚     β”œβ”€β”€ Scans IaC: Kubernetes, Terraform, Helm
              β”‚     β”œβ”€β”€ Detects misconfigurations (RBAC, networking, privilege escalation)
              β”‚     β”œβ”€β”€ Applies 70+ security rules
              β”‚     └── Assigns severity levels (CRITICAL β†’ LOW)
              β”‚
              β”œβ”€β”€ πŸ”‘ Secrets Detection (Gitleaks)
              β”‚     └── Identifies API keys, tokens, passwords, and exposed credentials
              β”‚
              β”œβ”€β”€ 🧠 Findings Processing
              β”‚     β”œβ”€β”€ Normalizes results (rule_id, severity, file path)
              β”‚     β”œβ”€β”€ Deduplicates issues
              β”‚     └── Attaches precise remediation guidance
              β”‚
              β”œβ”€β”€ 🚦 Enforcement Engine (CI/CD Gate)
              β”‚     β”œβ”€β”€ Evaluates findings against severity thresholds
              β”‚     └── Returns binary decision β†’ PASS / FAIL
              β”‚
              β”œβ”€β”€ πŸ—„οΈ Persistence Layer
              β”‚     └── Stores scan results, history, and findings in PostgreSQL
              β”‚
              └── πŸ“Š Real-time Feedback Loop
                    β”œβ”€β”€ Updates dashboard instantly
                    β”œβ”€β”€ Displays repo status (PASS / FAIL)
                    β”œβ”€β”€ Shows severity breakdown
                    └── Provides actionable fixes per finding

πŸš€ What it actually does

  • 🚫 Blocks insecure Kubernetes deployments before they ever reach your cluster
  • πŸ”‘ Prevents secrets from leaving your repo by detecting hardcoded credentials on every push
  • 🚦 Fails CI instantly on critical issues with a clear PASS/FAIL security gate
  • πŸ›‘οΈ Enforces security policies at deployment time using admission control (Kyverno)
  • πŸ” Detects misconfigurations across IaC and containers (Kubernetes, Terraform, Helm, images)
  • πŸ“Š Gives actionable insights, not just logs β€” every finding includes exact fixes and context

πŸ—οΈ Architecture

Component Technology Role
SecTL CLI Go 1.21+ Custom static analysis engine β€” 70+ built-in rules
Platform API Python / FastAPI Webhook receiver, scan orchestrator, REST API
Dashboard React + Vite Real-time scan results and repository management
Database PostgreSQL 16 Persistent storage for repos, scans, and findings
Secrets Scanner Gitleaks Detects hardcoded secrets and credentials

All services run in Docker Compose and communicate over an internal bridge network.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Docker Compose Network                 β”‚
β”‚                                                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  React       β”‚    β”‚  FastAPI     β”‚    β”‚ PostgreSQL  β”‚   β”‚
β”‚  β”‚  Dashboard   │◄──►│  Backend     │◄──►│    16       β”‚   β”‚
β”‚  β”‚  :3000       β”‚    β”‚  :8000       β”‚    β”‚  :5432      β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                             β”‚                              β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚                    β”‚   SecTL CLI     β”‚                     β”‚
β”‚                    β”‚   + Gitleaks    β”‚                     β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–²
                            β”‚  GitHub Webhook (ngrok tunnel)
                            β”‚
                      β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
                      β”‚  GitHub    β”‚
                      β”‚  Repos     β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ›‘οΈ SecTL β€” Security Enforcement Engine

SecTL is a purpose-built CLI tool written in Go. It scans Infrastructure-as-Code files for security misconfigurations and produces a binary PASS/FAIL exit code suitable for use as a CI/CD gate.

Scan Types

Type Target Coverage
k8s Kubernetes manifests Pods, Deployments, RBAC, Ingress, ConfigMaps, ServiceAccounts
terraform Infrastructure as Code AWS, GCP, Azure β€” S3, IAM, Security Groups, RDS, EKS, CloudTrail
helm Helm charts Chart.yaml, values.yaml, rendered templates
posture Live AWS account IAM root keys, MFA enforcement, password policy, S3 bucket posture
supply-chain Container images Digest pinning, :latest tag detection, EOL base images

Selected Rules

πŸ”΄ Kubernetes β€” Critical & High

Rule ID Severity Description
K8S-001 πŸ”΄ CRITICAL hostPID enabled β€” container sees all host processes
K8S-004 πŸ”΄ CRITICAL Privileged container β€” full host device access
K8S-020 πŸ”΄ CRITICAL RBAC wildcard apiGroups (*)
K8S-024 πŸ”΄ CRITICAL Binding to cluster-admin role
K8S-025 πŸ”΄ CRITICAL Binding to unauthenticated/anonymous subject
K8S-031 🟠 HIGH Hardcoded secret in environment variable
K8S-005 🟠 HIGH allowPrivilegeEscalation not set to false

πŸ”΄ Terraform β€” Critical & High

Rule ID Severity Description
TF-S3-010 πŸ”΄ CRITICAL S3 bucket ACL set to public
TF-IAM-001 πŸ”΄ CRITICAL IAM policy allows Action: * (all actions)
TF-SG-001 πŸ”΄ CRITICAL Security group: sensitive port open to internet
TF-RDS-002 πŸ”΄ CRITICAL RDS instance publicly accessible
TF-EKS-002 🟠 HIGH EKS API server publicly accessible

πŸ“‹ Full rule list: sectl rules β€” filter with --source k8s, --source terraform, --severity critical

Usage

# Scan Kubernetes manifests
sectl scan ./manifests --type k8s

# Scan Terraform β€” fail CI on HIGH or above
sectl scan ./infra --type terraform --severity high --fail-on-findings

# Scan Helm chart
sectl scan ./charts/myapp --type helm

# Verify container images (digest, EOL, latest tag)
sectl verify nginx:latest myapp:1.0.0

# Audit live AWS account posture
sectl audit --provider aws --region us-east-1

# JSON output for programmatic use
sectl scan ./manifests --type k8s --output json

# SARIF output for GitHub Security tab
sectl scan ./manifests --type k8s --output sarif

πŸš€ Quick Start

Prerequisites

Dependency Minimum Version Notes
Docker 24+ With Docker Compose plugin
Docker Compose 2.x Bundled with Docker Desktop
Go 1.21+ For compiling SecTL
Git Any For cloning and webhook use

Installation

# 1. Clone the repository
git clone https://github.com/Debasish-87/ZeroTrustOps-Platform.git
cd ZeroTrustOps-Platform

# 2. Run the one-command installer
bash setup.sh

The setup.sh script will automatically:

  1. βœ… Verify all prerequisites are installed
  2. βš™οΈ Compile the SecTL binary from source
  3. 🐳 Build and start all Docker containers
  4. 🩺 Wait for all services to pass health checks

Access

Service URL Description
πŸ“Š Dashboard http://localhost:3000 React UI β€” main interface
⚑ API http://localhost:8000 FastAPI backend
πŸ“– API Reference http://localhost:8000/docs Swagger / OpenAPI docs

GitHub Webhook Integration

# Step 1: Expose the local platform publicly via ngrok
ngrok http 8000

In your GitHub repository β†’ Settings > Webhooks > Add webhook:

Field Value
Payload URL https://<your-ngrok-url>/webhook/github
Content type application/json
Events βœ… Push events

Every subsequent git push will automatically trigger a full scan.

Uninstall

bash uninstall.sh

Removes all containers, volumes, images, networks, and the sectl binary. Source code is not affected.


🌐 REST API Reference

Method Endpoint Description Auth
GET /health Health check β€” all services β€”
GET /api/stats Dashboard overview counts β€”
GET /api/repos List all connected repositories β€”
POST /api/repos Add a new repository β€”
DELETE /api/repos/:id Remove a repository β€”
GET /api/scans List recent scans β€”
GET /api/scans/:id Scan detail with all findings β€”
POST /api/scans/trigger Manually trigger a scan β€”
POST /webhook/github GitHub push webhook receiver HMAC

Example: Trigger a Scan

curl -X POST http://localhost:8000/api/scans/trigger \
  -H "Content-Type: application/json" \
  -d '{"repo_id": 1}'

Example: Get Scan Findings

curl http://localhost:8000/api/scans/42 | jq '.findings[] | select(.severity == "CRITICAL")'

πŸ—‚οΈ Project Structure

ZeroTrustOps-Platform/
β”œβ”€β”€ setup.sh                    # One-command installer
β”œβ”€β”€ uninstall.sh                # Complete cleanup script
β”œβ”€β”€ docker-compose.yml          # Service orchestration
β”‚
β”œβ”€β”€ sectl/                      # Security CLI (Go)
β”‚   β”œβ”€β”€ main.go
β”‚   β”œβ”€β”€ cmd/                    # scan, audit, verify, rules commands
β”‚   β”‚   β”œβ”€β”€ audit.go
β”‚   β”‚   β”œβ”€β”€ helpers.go
β”‚   β”‚   β”œβ”€β”€ root.go
β”‚   β”‚   β”œβ”€β”€ rules.go
β”‚   β”‚   β”œβ”€β”€ scan.go
β”‚   β”‚   └── verify.go
β”‚   └── internal/
β”‚       β”œβ”€β”€ scanner/            # K8s, Terraform, Helm analyzers + unit tests
β”‚       β”‚   β”œβ”€β”€ finding.go
β”‚       β”‚   β”œβ”€β”€ helm.go
β”‚       β”‚   β”œβ”€β”€ k8s.go
β”‚       β”‚   β”œβ”€β”€ k8s_test.go
β”‚       β”‚   β”œβ”€β”€ terraform.go
β”‚       β”‚   └── terraform_test.go
β”‚       β”œβ”€β”€ posture/            # Live AWS account audit
β”‚       β”‚   └── aws.go
β”‚       β”œβ”€β”€ supply/             # Container image supply chain checks
β”‚       β”‚   └── chain.go
β”‚       └── report/             # Table, JSON, SARIF output renderers
β”‚           └── render.go
β”‚
β”œβ”€β”€ platform/
β”‚   β”œβ”€β”€ api/                    # FastAPI backend
β”‚   β”‚   β”œβ”€β”€ main.py             # Webhook handler, scan engine, REST API
β”‚   β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”‚   └── Dockerfile
β”‚   β”œβ”€β”€ web/                    # React dashboard
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/          # Dashboard, Repositories, Scans, Setup
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Repositories.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ScanDetail.jsx
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Scans.jsx
β”‚   β”‚   β”‚   β”‚   └── Setup.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”‚   └── Layout.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”‚   └── main.jsx
β”‚   β”‚   └── Dockerfile
β”‚   └── db/
β”‚       └── init.sql            # PostgreSQL schema
β”‚
└── manifests/
    β”œβ”€β”€ dev/                    # Hardened Kubernetes deployment example
    β”‚   β”œβ”€β”€ deployment.yaml
    β”‚   └── service.yaml
    └── kyverno-policies/       # Admission control enforcement policies
        β”œβ”€β”€ disallow-latest-tag.yaml
        β”œβ”€β”€ disallow-privileged.yaml
        └── require-resource-limits.yaml

πŸ›‘οΈ Kyverno Admission Control Policies

Three cluster-wide admission control policies are included. All run in Enforce mode β€” they actively block non-compliant resources from entering the cluster.

Policy Mode Enforcement
disallow-latest-tag Enforce Blocks containers using :latest or untagged images
disallow-privileged Enforce Blocks privileged containers, privilege escalation, host namespaces
require-resource-limits Enforce Requires CPU and memory requests and limits on all containers

Apply Policies

# Apply all Kyverno policies to your cluster
kubectl apply -f manifests/kyverno-policies/

# Verify policies are active
kubectl get clusterpolicy

πŸ—„οΈ Database Schema

organizations
    └── repositories
            └── scans
                    └── findings

Each finding record stores:

Field Type Description
tool text sectl or gitleaks
rule_id text e.g. K8S-001, TF-IAM-001
severity text CRITICAL, HIGH, MEDIUM, LOW
category text e.g. rbac, network, secrets
title text Short rule description
description text Full violation explanation
file_path text Relative path to the affected file
remediation text How to fix the violation

πŸ§ͺ Running Tests

# Unit tests for SecTL scanners
cd sectl
go test ./internal/scanner/... -v

# Run with race condition detection
go test -race ./internal/...

# Test against sample manifests
sectl scan ./sectl/testdata/k8s --type k8s
sectl scan ./sectl/testdata/terraform --type terraform

Test data included:

File Purpose
testdata/k8s/bad-deployment.yaml Triggers K8S rules
testdata/k8s/good-deployment.yaml Should produce zero findings
testdata/terraform/bad-infra.tf Triggers TF rules
testdata/terraform/good-infra.tf Should produce zero findings

βš™οΈ Configuration

Environment Variables

Create a .env file in the project root (copied from .env.example):

# Database
POSTGRES_USER=zerotrust
POSTGRES_PASSWORD=changeme
POSTGRES_DB=zerotrust

# GitHub Webhook
GITHUB_WEBHOOK_SECRET=your-secret-here

# API
API_HOST=0.0.0.0
API_PORT=8000

Docker Compose Ports

Service Internal Port External Port Configurable
Dashboard 3000 3000 βœ…
API 8000 8000 βœ…
PostgreSQL 5432 5432 βœ…

πŸ—ΊοΈ Roadmap

  • GitHub commit status API β€” report PASS/FAIL directly on pull requests
  • Slack and Microsoft Teams webhook notifications
  • Trivy container image vulnerability scanning
  • Falco runtime threat detection
  • SARIF upload to GitHub Advanced Security via API
  • Multi-organization support
  • Prometheus metrics endpoint (/metrics)
  • Role-based access control (RBAC) for multi-team environments
  • GitLab webhook support

🀝 Contributing

Contributions are welcome! Here's how to get started:

# Fork and clone
git clone https://github.com/<your-handle>/ZeroTrustOps-Platform.git
cd ZeroTrustOps-Platform

# Create a feature branch
git checkout -b feature/my-new-rule

# Add your rule in sectl/internal/scanner/
# Add a test in the corresponding _test.go file
# Add test data in sectl/testdata/

# Run tests
go test ./...

# Submit a pull request

Adding a new SecTL rule: See sectl/internal/scanner/k8s.go or terraform.go for patterns. Each rule requires a RuleID, Severity, Title, Description, and Remediation.

πŸ§ͺ Example

A developer pushes a Kubernetes manifest with:

  • privileged container enabled
  • latest image tag

β†’ Scan triggers automatically
β†’ Critical issues detected
β†’ CI fails
β†’ Deployment is BLOCKED

Nothing insecure reaches production.


πŸ’‘ Why this matters

Most security tools only detect issues.

ZeroTrustOps enforces them.

If it's insecure, it doesn't deploy. Period.


πŸ“„ License

Distributed under the Apache 2.0 License.


πŸ‘€ Maintainer

Debasish Mohanty

GitHub


"Trust nothing. Scan everything. Deploy with confidence."

⭐ Star this repo if it helps secure your infrastructure! ⭐

About

A Kubernetes-native DevSecOps pipeline that scans every commit, blocks insecure configurations, and enforces policies before deployment. Ensures only secure infrastructure reaches production.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors