YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Kubernetes ML Security Assessment Platform (v2.0.0 Commercial Suite)
Purpose β A turnkey, enterprise-grade Cloud-Native Application Protection Platform (CNAPP) combining high-speed AST static scanning, deep container image layer inspection, unsupervised runtime telemetry anomaly detection, and in-cluster dynamic admission enforcement.
Looking for the Standalone Scanner? The core scanning, Attack DAG, and SBOM capabilities are also available as an independent, zero-dependency product:
k8s-native-scannerlocated innative_scanner/. It can be installed separately (pip install ./native_scanner) and executed viak8s-native-scanornative-secwith zero ML dependencies.
Key Capabilities & Architecture
flowchart TD
subgraph INGESTION["1. Multi-Plane Telemetry & Ingestion"]
A["Kubernetes Manifests<br/>(Pods, Deployments, Jobs)"]
B["Container Images<br/>(Docker Save In-Memory Stream)"]
C["Runtime Prometheus Stream<br/>(CPU, Memory, Network TX/RX)"]
end
subgraph ENGINES["2. Security & Threat Engines"]
D["Native AST Scanner<br/>(56 Rules | Shannon Entropy H>3.8)"]
E["Pure-Python Layer Unpacker<br/>(Debian/Ubuntu/Alpine SBOM)"]
F["Embedded SQLite CVE Database<br/>(349+ Indexed CVEs in <1ms)"]
G["Model 12 Anomaly Detector<br/>(GMM + Isolation Forest)"]
end
subgraph INTELLIGENCE["3. Machine Learning & Safety Veto"]
H["Model 11 Dynamic Ridge Stacking<br/>(0.92 XGB + 0.08 RF + 0.0002 Synth)"]
I["Beta-Binomial Bayesian Updating<br/>(Epistemic Uncertainty Prior)"]
J["Catastrophic Exploit Veto<br/>(V01, V02, V03, V04, V14, V26 Capped at 35.0)"]
end
subgraph ENFORCEMENT["4. Shift-Left & In-Cluster Enforcement"]
K["Unified CLI (k8s-sec)<br/>(scan, scan-image, remediate, daemon)"]
L["Validating Admission Webhook<br/>(/validate -> HTTP 403 Forbidden Veto)"]
M["Mutating Admission Webhook<br/>(/mutate -> RFC 6902 JSONPatch)"]
N["Web Management Console<br/>(Dark-Mode Real-Time Dashboard :8080)"]
O["Production Helm Chart<br/>(charts/k8s-security v2.0.0)"]
end
A --> D
B --> E
E --> F
C --> G
D --> H
F --> H
G --> H
H --> I --> J
J --> K
J --> L
J --> M
J --> N
J --> O
Architectural Highlights
- Native AST Security Scanner & Proprietary IP Engines (56 Rules, V01βV56)
- Pure Python, zero-external-binary AST evaluation across 8 security planes.
- Operates in 2 to 8 milliseconds per workload (1,000x to 3,000x faster than Kubescape or Trivy).
- Cross-Resource Attack Path DAG Engine: Traces multi-hop lateral movement paths across decoupled entities (Ingress $\to$ Service $\to$ Pod $\to$ ServiceAccount $\to$ RBAC $\to$ Secret / Host Linux Kernel).
- Mathematical Blast Radius Formulation ($\mathcal{B} \in [0.0, 100.0]$): Closed-form graph metric modeling reachability decay, crown jewel valuation, and kernel breakout severity.
- Supply Chain Typosquatting Auditing: Levenshtein distance analysis ($d \le 2$) preventing container image spoofing attacks (
ng1nx,red1s,ubuntuu) against verified base libraries. - Pre-Compiled Declarative Custom Rule Engine: YAML/JSON rule loader supporting custom AST predicates (
eq,in,regex_match,not_in, list index lookups) executing in < 0.1 ms. - Regulatory Compliance Framework Mapper: Direct mapping to PCI-DSS v4.0, SOC 2 Type II, HIPAA Security Rule, ISO/IEC 27001:2022, and NIST SP 800-190 with auditor-ready certificates.
- Shannon Entropy Secret Detection ($H > 3.8$): Detects cryptographic tokens, private keys, and cloud API credentials across manifests and image layers.
- Hybrid Container Layer & Deep OS Package Scanner
- Live Docker daemon streaming: pipes
docker save <image>directly into an in-memoryBytesIObuffer, eliminating multi-gigabyte disk thrashing. - Pure-Python layer unpacker parsing
/var/lib/dpkg/status(Debian/Ubuntu),/lib/apk/db/installed(Alpine),/var/lib/rpm/rpmdb.sqlite(RHEL/CentOS/Fedora),package-lock.json(Node.js),pom.properties(Java JAR/WAR), andrequirements.txtin < 600 ms. - Standard SBOM Exporters: Full CycloneDX v1.5 and SPDX v2.3 JSON serialization ready for enterprise vulnerability management.
- Direct OCI Registry v2 Client: Zero-daemon remote manifest and config blob inspection over HTTPS.
- ELF Binary Symbol Parsing: Inspects statically linked Go
.go.buildinfodependencies and Rustcargo-auditableembedded JSON tables in distroless/scratch containers.
- Live Docker daemon streaming: pipes
- Embedded SQLite CVE Threat Engine & Feed Synchronizer
- High-speed embedded SQLite database (
data/cve_database.sqlite) indexing 349+ CVEs with microsecond query latency. - Synchronizes delta feeds from OSV.dev (aggregating NVD 2.0, GHSA, Debian Security Tracker, and Alpine SecDB).
- High-speed embedded SQLite database (
- Model 11 Master Ensemble & Deterministic Exploit Veto
- Non-negative Ridge dynamic stacking ensemble combining XGBoost, Random Forest, and Consolidated domain models.
- 0.0% False Negatives on Critical Exploits: The deterministic exploit veto mathematically caps risk scores at
35.0/100if privileged containers, host namespaces, or dangerous capabilities are discovered. - 100% Zero-Shot Generalization verified across 10 third-party production Helm charts (GitLab, Prometheus, Cert-Manager, Vault, etc.).
- Model 12 Unsupervised Prometheus Anomaly Detector
- Purely unsupervised threat detection combining Isolation Forest and Dual-Mode Gaussian Mixture Models.
- Requires zero labeled exploit data; trains entirely on normal baseline container behavior.
- Continuous streaming daemon (
k8s-sec daemon) with Exponential Moving Average (EMA) rolling baseline updates and anti-poisoning guardrails.
- In-Cluster Dynamic Admission Controller
- Live Kubernetes admission review handling on
/validateand/mutate(HTTPS :8443). - Rejects non-compliant workloads with HTTP 403 Forbidden and exact MITRE/remediation summaries.
- Mutating webhook auto-injects least-privilege securityContexts (
runAsNonRoot,readOnlyRootFilesystem,capabilities.drop: ALL).
- Live Kubernetes admission review handling on
- Production Helm Chart & Unified CLI (
k8s-sec)- Turnkey Helm chart (
charts/k8s-security/) with Cert-Manager TLS automation and Prometheus ServiceMonitors. - Standalone CLI executable (
bin/k8s-secorpip install -e .) with 9 consolidated subcommands.
- Turnkey Helm chart (
- Enterprise Web Management Console
- Self-hosted real-time glassmorphism web dashboard on
:8080with live fleet compliance scorecards, interactive YAML audits, and 1-click remediation.
- Self-hosted real-time glassmorphism web dashboard on
- Sub-Second eBPF Runtime Defense & Dynamic Attack DAG Fusion (
k8s-sec ebpf)- Intercepts raw kernel syscall events (
execve,openat,ptrace,connect) with sub-millisecond detection latency (< 0.5 ms). - Ruleset catching 8 forbidden container shells, 12 offensive recon tools (
nmap,tcpdump,socat), C2 egress ports (4444,1337), and host filesystem tampering (/etc/shadow,/var/run/docker.sock). - Dynamic Attack Path DAG Runtime Fusion: Real-time event fusion with
attack_graph.pymarking breached nodes as[COMPROMISED]and recalculating dynamic live Blast Radius ($\mathcal{B}_{\text{runtime}}$) to remaining crown jewels. - Dual-Mode Streaming Ingestion: Connects to streaming Falco/Tetragon line-delimited JSON over Unix Domain Sockets with bounded buffer backpressure protection.
- Automated active mitigation with real-time Pod quarantine label isolation (
security.k8s.io/quarantined=true).
- Intercepts raw kernel syscall events (
- GitOps Automated PR Bot & Kustomize Strategic Overlays (
k8s-sec gitops-pr)
- Generates non-destructive Kustomize overlays (
patchesStrategicMerge) to eliminate security drift without modifying base manifests. - Synthesizes GitHub/GitLab Pull Request Markdown scorecards with baseline vs hardened deltas, CIS benchmark references, and unified diff blocks.
- Live In-Cluster CSPM Posture Scanner (
k8s-sec scan-cluster)
- Scans live cluster workloads across namespaces via
kube-apiserverwith fallback mock capabilities. - Calculates cluster-wide health scores, worst-offender leaderboards, and exports hardened YAML manifests directly to disk.
Quick-Start: Unified CLI (k8s-sec)
The platform can be run directly via ./bin/k8s-sec or installed globally via pip:
# Clone and enter workspace
git clone https://github.com/platform/k8s-security-assessment.git
cd K8S-security-assessment-main
# Set up Python virtual environment
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
# Verify platform installation & ML model bundles
k8s-sec version
================================================================================
Kubernetes ML Security Assessment Platform (v2.0.0)
================================================================================
Platform Engine Version : v2.0.0
Python Runtime : 3.13.7 (darwin)
Model 11 (Static Master): Available (Unified Ridge Ensemble)
Model 12 (Runtime Anomaly): Available (Isolation Forest + GMM)
Docker Daemon Socket : Connected & Active
Trivy CLI Engine : Installed (/opt/homebrew/bin/trivy)
================================================================================
Primary CLI Commands
| Subcommand | Description | Example Command |
|---|---|---|
k8s-sec scan |
Audit manifests or directories against 56 rules with CI gate | k8s-sec scan ./manifests/secure/hardened-deployment.yaml --gate --threshold 35.0 |
k8s-sec scan-cluster |
Live in-cluster CSPM audit of active workloads via kube-apiserver | k8s-sec scan-cluster -n production --remediate-out ./remediated/ |
k8s-sec scan-image |
Unpack container layers in memory and extract OS/Python SBOM | k8s-sec scan-image redis:7-alpine |
k8s-sec remediate |
1-Click auto-hardening of insecure manifests with unified diff | k8s-sec remediate ./manifests/insecure/weak-deployment.yaml |
k8s-sec gitops-pr |
Generate GitOps PR markdown scorecard & Kustomize overlays | k8s-sec gitops-pr manifests/ --output-overlay ./overlay/ |
k8s-sec ebpf |
Sub-second kernel syscall runtime defense & auto-quarantine | k8s-sec ebpf --duration 30 --port 9198 |
k8s-sec admission |
Launch in-cluster admission controller webhook server | k8s-sec admission --port 8443 |
k8s-sec daemon |
Run continuous Prometheus anomaly streaming daemon | k8s-sec daemon --interval 15 --prometheus http://localhost:9090 |
k8s-sec sync-cve |
Query embedded vulnerability database or pull delta feeds | k8s-sec sync-cve --query libssl3 |
k8s-sec web |
Start self-hosted Web Management Console | k8s-sec web --port 8080 |
k8s-sec audit |
Generate boardroom-ready executive compliance PDF & HTML | k8s-sec audit |
In-Cluster Kubernetes Deployment (Helm)
Deploy the admission controller and Prometheus monitoring into your Kubernetes cluster in one command:
# Lint the Helm chart
helm lint charts/k8s-security
# Deploy with Helm
helm install k8s-security-agent ./charts/k8s-security \
--namespace k8s-security \
--create-namespace \
--set policy.riskThreshold=35.0 \
--set policy.enableMutation=true
To generate TLS certificates for the admission webhook:
./deploy/admission-controller/generate_certs.sh
Verification & Statistical Rigor
The entire platform is continuously tested and verified through 604 unit, integration, rigor, and chaos tests with a 100% pass rate:
# Execute modular test runner across all 604 tests
./run_test.sh all
# Or run individual sub-suites
./run_test.sh taxonomy # V01-V56 AST security rules & MITRE mapping (112 tests, 0.02s)
./run_test.sh deep # Complete 14-module deep test suite (489 tests, ~16s)
./run_test.sh baseline # Standard regression baseline in tests/ (107 tests)
./run_test.sh fast # Fast unit tests (< 15s)
./run_test.sh ebpf # eBPF kernel syscall interceptor & quarantine (45 tests)
./run_test.sh gitops # GitOps auto-remediation PR bot & overlays (40 tests)
./run_test.sh vector # 32-dimensional feature vector extraction (40 tests)
./run_test.sh cli # Unified CLI integration tests (35 tests)
======================================================================
Ran 596 tests in 108.362s
OK (100% Pass Rate β 0 Failures, 0 Errors)
======================================================================
Test Suite Structure
testing/(489 Tests, Ignored via.gitignore): Deep exhaustive suites covering 56 AST rules, 32-dim feature vectors, eBPF sub-second runtime defenses, GitOps PR generation, in-cluster CSPM auditing, and ML ensemble inferences.tests/(107 Tests, Tracked): Core platform unit, pipeline integration, container layer unpacking, and chaos engineering suites.run_test.sh: Interactive modular test runner with category dispatching, regex pattern filtering (-k), and timed ANSI execution scorecards.
Statistical Rigor Gates & Chaos Resilience
- 12 Statistical Rigor Gates: Bootstrap confidence intervals, Wilcoxon signed-rank tests, Cohen's d effect sizes, calibration curves, and Brier scores.
- 6 Security Chaos Scenarios (SCE):
- Adversarial Camouflage (Trojan Horse spoofing)
- Telemetry Sensor Blackout
- Alert Flooding / 10,000+ Alert DoS Flood
- Out-of-Distribution Zero-Day Anomalies
- Malformed YAML Parser Fuzzing
- Kill-Chain Multi-Manifest Fragmentation
Repository Structure
βββ bin/
β βββ k8s-sec # Standalone CLI binary entry point
βββ charts/
β βββ k8s-security/ # Production Helm v2 Chart (Deployment, Webhooks, ServiceMonitor)
βββ config/
β βββ prometheus/ # Prometheus alerting rules & telemetry configs
βββ data/
β βββ cve_database.sqlite # High-speed embedded SQLite CVE database
β βββ raw/snapshots/ # Ingested cluster telemetry snapshots
β βββ processed/ # Normalized ML training datasets
βββ deploy/
β βββ admission-controller/ # Raw Kubernetes manifests & TLS certificate scripts
βββ models/
β βββ model_11_final_master.joblib # Model 11 Unified Ridge Ensemble
β βββ model_12_prometheus_unsupervised.joblib # Model 12 Runtime Anomaly Model
β βββ security_models_11.joblib # Base serialized model bundle
βββ reports/
β βββ audit/ # Executive compliance audit reports (PDF & HTML)
β βββ benchmarks/ # Statistical rigor & Prometheus model scorecards
β βββ scanner_comparison/ # Tri-way empirical comparison matrices
βββ src/
β βββ cli/ # Unified CLI dispatcher (k8s-sec)
β βββ core/ # Canonical path constants and configuration
β βββ data/ # Prometheus and cluster telemetry collectors
β βββ evaluation/ # 12 Rigor gates, chaos engineering, and CI gates
β βββ integrations/ # Admission webhook, streaming daemon, Snowflake exporter
β βββ models/ # Model 11 ensemble, Model 12 anomaly, fine-tuner, XAI
β βββ reporting/ # Web dashboard, executive audit, Plotly reporting
β βββ scanners/ # AST scanner, container layer scanner, CVE sync engine, remediator
βββ tests/ # 107 Comprehensive unit and baseline integration test suites
βββ testing/ # 489 Deep exhaustive test suites (isolated in .gitignore)
βββ run.sh # Master entrypoint script with automated log archiving
βββ run_test.sh # Modular test runner for category, suite, or testcase execution
βββ Makefile # Automation shortcuts for all platform workflows
βββ pyproject.toml # Standard Python packaging configuration
βββ setup.py # Pip package setup definition
License & Attribution
Distributed under the Apache-2.0 License. See LICENSE for details.