Skip to content

Commit a19dd90

Browse files
mayurkrclaude
andauthored
feat: multi-cloud security scanning — 48 AWS checks, CloudAccountConfig CRD, CNAPP v1.0 (#65)
* feat: add multi-cloud security scanning with 48 AWS checks across 6 CNAPP categories Implements Phase 1 Cloud Expansion, transforming Zelyo from K8s-only to a full CNAPP with the Detect-Correlate-Fix pipeline extended to cloud infrastructure. New capabilities: - CloudAccountConfig CRD for onboarding AWS accounts (IRSA, Pod Identity, Secret auth) - 48 cloud security scanners: CSPM (8), CIEM (8), Network (8), DSPM (8), Supply Chain (8), CI/CD Pipeline (8) - CloudScanner interface + thread-safe Registry (parallel to K8s Scanner) - AWS SDK v2 client factory with multi-region scanning support - SOC 2, PCI-DSS, HIPAA compliance framework mappings (30 cloud controls) - Cloud IaC remediation prompts (Terraform/CloudFormation-aware) - Cloud scan metrics (completed total, findings gauge, resources scanned, duration) - RBAC roles (admin/editor/viewer) for CloudAccountConfig - Helm chart updated with cloud CRD, ClusterRole, and credential annotations - Documentation rewritten for CNAPP positioning with cloud scanning recipes - Version bumped to 1.0.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: consolidate quickstart and update LLM model examples to Claude Sonnet 4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review — multi-region clients, GenerateName, wildcard principals, ECR tags - ScanReport now uses GenerateName to avoid 63-char K8s name limit - Multi-region scanning creates per-region AWS clients instead of reusing a single-region client for all regions - Cross-account trust scanner now flags wildcard principals ("*") without conditions as dangerous - ECR scanner checks the most recently pushed image instead of hardcoding the "latest" tag - Extracted runSingleScanner helper to reduce cyclomatic complexity Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: rewrite README for accuracy — fix diagrams, badges, examples, remove duplicates - Removed duplicate badge row pointing to non-existent zelyo-ai/zelyo repo - Updated pipeline diagram to include CloudAccountConfig cloud scanning - Updated architecture diagram to show cloud scanner and AWS API inputs - Fixed SecurityPolicy example (removed non-existent fields) - Fixed RemediationPolicy branchPrefix to "zelyo-operator/fix-" - Added CloudAccountConfig quick example - Removed duplicate quickstart.md references in docs table - Updated Go version to 1.26+ (matches Dockerfile) - Updated test package count to 15 (verified) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: add Claude Code review workflow for @claude mentions on issues and PRs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove Claude Code workflows, add CLAUDE.md project guide Remove GitHub Action workflows (claude.yml, claude-review.yml) since they require a paid API key. Keep CLAUDE.md for local Claude Code usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add zelyo-policies Helm chart with tiered security profiles Introduces a helper chart that deploys production-ready default policies covering all 56 scanners. Three security profiles (starter, standard, strict) with per-environment namespace targeting, compliance presets (CIS, SOC2, PCI-DSS, HIPAA, NIST, ISO 27001), and full configurability for cloud accounts, notifications, GitOps, and remediation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: rewrite quickstart as production-grade guide Remove k3d/local-build references, assume existing cluster with kubectl. Restructure as a linear 4-step install (cert-manager → operator → LLM key → zelyo-policies). Convert inline kubectl-apply blocks to clean YAML snippets. Simplify teardown to Helm uninstalls only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: remove cert-manager version pin from install commands Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 89e6f13 commit a19dd90

107 files changed

Lines changed: 9694 additions & 952 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: read
1111

1212
env:
13-
GO_VERSION: "1.25"
13+
GO_VERSION: "1.26"
1414
GOLANGCI_LINT_VERSION: "v2.8.0"
1515

1616
jobs:

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ linters:
9898
- path: internal/controller/
9999
linters:
100100
- dupl
101+
# Cloud scanner implementations — interface methods and AWS SDK value types
102+
- path: internal/cloudscanner/
103+
linters:
104+
- revive
105+
- dupl
106+
- gocritic
107+
- goconst
101108
# Kubebuilder-generated main.go
102109
- path: cmd/main\.go
103110
linters:

AGENTS.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ This document details the internal intelligence architecture.
99
```mermaid
1010
graph TB
1111
subgraph "Observe"
12-
SC["SecurityPolicy Controller<br/>security scanning"]
12+
SC["SecurityPolicy Controller<br/>K8s pod scanning"]
1313
MC["MonitoringPolicy Controller<br/>pod restarts, events"]
1414
CS["ClusterScan Controller<br/>scheduled compliance scans"]
15+
CA["CloudAccountConfig Controller<br/>cloud API scanning"]
1516
end
1617
1718
subgraph "Reason"
@@ -29,6 +30,7 @@ graph TB
2930
end
3031
3132
SC -->|findings| CE
33+
CA -->|cloud findings| CE
3234
MC -->|pod metrics| AD
3335
AD -->|anomalies| CE
3436
CS -->|findings| CF
@@ -103,10 +105,11 @@ Maps security findings to industry compliance controls, generating **audit-ready
103105

104106
| Feature | Implementation |
105107
|---|---|
106-
| **CIS Kubernetes Benchmark** | 15 controls mapped to scanner rule types (pod-security, RBAC, secrets, etc.) |
108+
| **CIS Kubernetes Benchmark** | 15 K8s controls mapped to scanner rule types (pod-security, RBAC, secrets, etc.) |
109+
| **SOC 2 / PCI-DSS / HIPAA** | 30 cloud controls mapped to CSPM, CIEM, Network, DSPM, Supply Chain, and CI/CD rule types |
107110
| **Finding Evaluation** | `EvaluateFindings()` maps findings to controls via `RelatedRuleTypes`, attaches evidence |
108-
| **Multi-Framework** | Architecture supports CIS, NIST 800-53, SOC 2, PCI-DSS, HIPAA, ISO 27001 |
109-
| **ClusterScan Integration** | After every scan, evaluates CIS compliance and emits `ComplianceViolation` Kubernetes events |
111+
| **Multi-Framework** | CIS K8s, NIST 800-53, SOC 2, PCI-DSS, HIPAA, ISO 27001 |
112+
| **ClusterScan + Cloud Integration** | After every K8s or cloud scan, evaluates compliance and emits events |
110113

111114
### 6. Live Drift Detection (`internal/drift`)
112115

@@ -147,14 +150,17 @@ The reasoning core. Built for resilient, cost-effective, 24/7 autonomous operati
147150

148151
## Controller Orchestration
149152

150-
The AI Security Agent's autonomy lives in the **7 Kubernetes controllers** that wire the pipeline together:
153+
The AI Security Agent's autonomy lives in the **10 Kubernetes controllers** that wire the pipeline together:
151154

152155
| Controller | Detect | Correlate | Fix |
153156
|---|---|---|---|
154-
| `SecurityPolicy` | Scans pods for violations | Feeds findings into correlator ||
157+
| `SecurityPolicy` | Scans K8s pods for violations | Feeds findings into correlator ||
158+
| `CloudAccountConfig` | Scans cloud accounts (48 checks) | Evaluates SOC2/PCI-DSS/HIPAA | Creates ScanReport CRs |
155159
| `MonitoringPolicy` | Watches pod restart counts | Feeds into anomaly detector → correlator ||
156160
| `RemediationPolicy` || Queries correlator for open incidents | Generates LLM plan → opens GitOps PR |
157-
| `ClusterScan` | Runs scheduled security scans | Evaluates CIS compliance | Creates ScanReport CRs |
161+
| `ClusterScan` | Runs scheduled K8s security scans | Evaluates CIS compliance | Creates ScanReport CRs |
162+
| `ScanReport` | Stores scan results |||
163+
| `NotificationChannel` ||| Routes alerts to Slack, Teams, PagerDuty |
158164
| `GitOpsRepository` | Discovers repo structure || Provides Git context for remediation |
159165
| `CostPolicy` | Analyzes resource utilization | Identifies optimization opportunities ||
160166
| `ZelyoConfig` ||| Configures global settings |

CLAUDE.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Zelyo Operator — Project Guide for Claude
2+
3+
## What is this project?
4+
5+
Zelyo Operator is an open-source **Cloud-Native Application Protection Platform (CNAPP)** that runs as a Kubernetes operator. It detects security issues across Kubernetes workloads and AWS cloud accounts, correlates findings with an LLM, and auto-generates GitOps pull requests with fixes.
6+
7+
**Core identity:** Zelyo is a security product. Every code change must be evaluated through a security lens.
8+
9+
## Architecture
10+
11+
- **10 controllers** in `internal/controller/` orchestrate the Detect → Correlate → Fix pipeline
12+
- **8 K8s scanners** in `internal/scanner/` check pods for security violations
13+
- **48 cloud scanners** in `internal/cloudscanner/` (CSPM, CIEM, Network, DSPM, Supply Chain, CI/CD) scan AWS accounts
14+
- **LLM reasoner** in `internal/remediation/` generates structured JSON fix plans
15+
- **GitHub engine** in `internal/github/` opens PRs autonomously
16+
17+
## Key design constraints
18+
19+
1. **Read-only access** — Zelyo never mutates cluster state or cloud resources. All scanners use read-only APIs only.
20+
2. **Non-destructive remediation** — fixes are always PRs, never direct changes. Human review required.
21+
3. **63-char K8s name limit** — ScanReport names must use `GenerateName`, not `Name`.
22+
4. **AWS per-region clients** — AWS SDK v2 clients are region-bound at creation. Use `NewClientsForRegion()` factory for multi-region scanning.
23+
24+
## Code conventions
25+
26+
- **Go 1.26**, **golangci-lint v2** with 30+ linters (gocyclo threshold: 15)
27+
- Errors wrapped with `fmt.Errorf("context: %w", err)` — never bare `return err`
28+
- Large structs passed by pointer (enforced by gocritic)
29+
- All cloud scanner types implement `cloudscanner.CloudScanner` interface
30+
- All K8s scanner types implement `scanner.Scanner` interface
31+
- Rule type constants live in `api/v1alpha1/condition_types.go`
32+
- Findings are always `scanner.Finding` — no custom finding structs
33+
34+
## Testing
35+
36+
- `make test` runs 15 packages
37+
- Controllers use Ginkgo/Gomega with envtest
38+
- Unit tests use standard `testing` package
39+
- Cloud scanners should test pagination, empty results, and error paths
40+
41+
## What NOT to do
42+
43+
- Do not add AWS write permissions (no PutObject, DeleteBucket, etc.)
44+
- Do not bypass golangci-lint checks with `//nolint` without justification
45+
- Do not add external dependencies without strong justification
46+
- Do not use `Name:` for ScanReport creation — always `GenerateName:`
47+
- Do not log secrets, credentials, or API keys at any log level

PROJECT

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,13 @@ resources:
9494
kind: GitOpsRepository
9595
path: github.com/zelyo-ai/zelyo-operator/api/v1alpha1
9696
version: v1alpha1
97+
- api:
98+
crdVersion: v1
99+
namespaced: true
100+
controller: true
101+
domain: zelyo.ai
102+
group: zelyo-operator
103+
kind: CloudAccountConfig
104+
path: github.com/zelyo-ai/zelyo-operator/api/v1alpha1
105+
version: v1alpha1
97106
version: "3"

0 commit comments

Comments
 (0)