Datasets:
finops new scenarios
#1
by bturkkan - opened
This view is limited to 50 files because it contains too many changes. See the raw diff here.
- README.md +8 -37
- snapshots/ciso/v0.1/README-eval.md +0 -245
- snapshots/ciso/v0.1/README.md +0 -183
- snapshots/ciso/v0.1/eval.py +0 -463
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/collected_data.json +0 -5
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/fetch.sh +0 -68
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/policy.rego +0 -50
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/problem.md +0 -75
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/configmaps/kube-root-ca.crt.yaml +0 -34
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/deployments/test-deployment.yaml +0 -67
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/pods/test-deployment-8d799b458-pvbmp.yaml +0 -121
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/replicasets/test-deployment-8d799b458.yaml +0 -59
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/benchmark-admin-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/benchmark-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/compliant-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/benchmark-admin-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/cluster-admin-like-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/limited-role.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/wildcard-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/benchmark-admin-sa.yaml +0 -12
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/benchmark-sa.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/default.yaml +0 -8
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/test-sa-compliant.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/test-sa-violation.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/violating-sa.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/services/test-service.yaml +0 -29
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/configmaps/kube-root-ca.crt.yaml +0 -34
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/deployments/test-deployment.yaml +0 -67
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/pods/test-deployment-8d799b458-pvbmp.yaml +0 -121
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/replicasets/test-deployment-8d799b458.yaml +0 -59
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/benchmark-admin-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/benchmark-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/compliant-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/violating-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/violation-binding.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/benchmark-admin-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/cluster-admin-like-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/limited-role.yaml +0 -19
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/wildcard-role.yaml +0 -18
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/benchmark-admin-sa.yaml +0 -12
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/benchmark-sa.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/default.yaml +0 -8
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/test-sa-compliant.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/test-sa-violation.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/violating-sa.yaml +0 -11
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/services/test-service.yaml +0 -29
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/ground-truth/fetch.sh +0 -38
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/ground-truth/policy.rego +0 -47
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/problem.md +0 -57
- snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/static-resources-compliant/deployments-all.yaml +0 -74
README.md
CHANGED
|
@@ -21,10 +21,6 @@ dataset_info:
|
|
| 21 |
data_files:
|
| 22 |
- split: scenarios
|
| 23 |
path: snapshots/finops/v0.1-finops-anomaly/Scenario-*/
|
| 24 |
-
- config_name: ciso
|
| 25 |
-
data_files:
|
| 26 |
-
- split: scenarios
|
| 27 |
-
path: snapshots/ciso/v0.1/k8s-opa-static-cis-*/
|
| 28 |
size_categories:
|
| 29 |
- 10K<n<100K
|
| 30 |
task_categories:
|
|
@@ -37,7 +33,6 @@ tags:
|
|
| 37 |
- kubernetes
|
| 38 |
- sre
|
| 39 |
- finops
|
| 40 |
-
- ciso
|
| 41 |
- incident-response
|
| 42 |
- fault-diagnosis
|
| 43 |
- root-cause-analysis
|
|
@@ -60,11 +55,10 @@ pretty_name: ITBench-Lite
|
|
| 60 |
**Paper**: [ITBench: Evaluating AI Agents across Diverse Real-World IT Automation Tasks](https://arxiv.org/pdf/2502.05352)
|
| 61 |
**GitHub**: [ITBench](https://github.com/itbench-hub/ITBench)
|
| 62 |
|
| 63 |
-
ITBench-Lite is a systematic framework for benchmarking LLMs and AI Agents on real-world IT automation tasks. This dataset contains **
|
| 64 |
|
| 65 |
- **Site Reliability Engineering (SRE)**: 35 scenarios with environment snapshots for incident diagnosis
|
| 66 |
- **Financial Operations (FinOps)**: 15 scenarios with synthetic cost anomaly data for spend analysis
|
| 67 |
-
- **Compliance & Security Operations (CISO)**: 15 scenarios with Kubernetes resources for compliance assessment
|
| 68 |
|
| 69 |
## Summary
|
| 70 |
|
|
@@ -102,21 +96,11 @@ ITBench-Lite/
|
|
| 102 |
│ │ ├── Scenario-2/
|
| 103 |
│ │ └── ... (35 scenarios total)
|
| 104 |
│ │
|
| 105 |
-
│
|
| 106 |
-
│
|
| 107 |
-
│
|
| 108 |
-
│
|
| 109 |
-
│
|
| 110 |
-
│ │ └── ... (15 scenarios total)
|
| 111 |
-
│ │
|
| 112 |
-
│ └── ciso/
|
| 113 |
-
│ └── v0.1/
|
| 114 |
-
│ ├── k8s-opa-static-cis-5.1.1/
|
| 115 |
-
│ │ ├── ground-truth/
|
| 116 |
-
│ │ │ ├── fetch.sh # Script to fetch resources
|
| 117 |
-
│ │ │ └── policy.rego # OPA policy definition
|
| 118 |
-
│ │ └── static-resources-compliant/ # Kubernetes resources
|
| 119 |
-
│ ├── k8s-opa-static-cis-5.1.6/
|
| 120 |
│ └── ... (15 scenarios total)
|
| 121 |
```
|
| 122 |
|
|
@@ -151,19 +135,6 @@ Each FinOps scenario contains synthetic cost anomaly data:
|
|
| 151 |
"account_id": "49tAGZz"
|
| 152 |
}
|
| 153 |
```
|
| 154 |
-
#### CISO Scenarios (15 scenarios)
|
| 155 |
-
|
| 156 |
-
Each CISO scenario contains Kubernetes resources and compliance assessment tasks:
|
| 157 |
-
|
| 158 |
-
| File | Format | Description |
|
| 159 |
-
|------|--------|-------------|
|
| 160 |
-
| `problem.md` | Markdown | Task description for compliance assessment for agents |
|
| 161 |
-
| `static-resources/` | YAML | Kubernetes resources with embedded compliance violations |
|
| 162 |
-
| `ground-truth/policy.rego` | Rego | Reference OPA policy solution |
|
| 163 |
-
| `ground-truth/fetch.sh` | Shell | Reference resource collection script |
|
| 164 |
-
| `static-resources-compliant/` | YAML | Compliant Kubernetes resources (used only for evaluation) |
|
| 165 |
-
|
| 166 |
-
**Note**: `problem.md` and `static-resources/` are provided as input to agents for solving the compliance assessment task.
|
| 167 |
|
| 168 |
## Tasks
|
| 169 |
|
|
@@ -175,9 +146,9 @@ Identify the faulty entity or resource (e.g., a specific pod, service, or deploy
|
|
| 175 |
|
| 176 |
Identify the resource responsible for anomalous cost changes using synthetic cost anomaly details and workload configuration.
|
| 177 |
|
| 178 |
-
### CISO: Compliance Assessment
|
| 179 |
|
| 180 |
-
|
| 181 |
|
| 182 |
## Limitations
|
| 183 |
|
|
|
|
| 21 |
data_files:
|
| 22 |
- split: scenarios
|
| 23 |
path: snapshots/finops/v0.1-finops-anomaly/Scenario-*/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
size_categories:
|
| 25 |
- 10K<n<100K
|
| 26 |
task_categories:
|
|
|
|
| 33 |
- kubernetes
|
| 34 |
- sre
|
| 35 |
- finops
|
|
|
|
| 36 |
- incident-response
|
| 37 |
- fault-diagnosis
|
| 38 |
- root-cause-analysis
|
|
|
|
| 55 |
**Paper**: [ITBench: Evaluating AI Agents across Diverse Real-World IT Automation Tasks](https://arxiv.org/pdf/2502.05352)
|
| 56 |
**GitHub**: [ITBench](https://github.com/itbench-hub/ITBench)
|
| 57 |
|
| 58 |
+
ITBench-Lite is a systematic framework for benchmarking LLMs and AI Agents on real-world IT automation tasks. This dataset contains **50 scenarios** across two critical domains:
|
| 59 |
|
| 60 |
- **Site Reliability Engineering (SRE)**: 35 scenarios with environment snapshots for incident diagnosis
|
| 61 |
- **Financial Operations (FinOps)**: 15 scenarios with synthetic cost anomaly data for spend analysis
|
|
|
|
| 62 |
|
| 63 |
## Summary
|
| 64 |
|
|
|
|
| 96 |
│ │ ├── Scenario-2/
|
| 97 |
│ │ └── ... (35 scenarios total)
|
| 98 |
│ │
|
| 99 |
+
│ └── finops/
|
| 100 |
+
│ └── v0.1-finops-anomaly/
|
| 101 |
+
│ ├── Scenario-1/
|
| 102 |
+
│ │ └── anomaly.json # Cost anomaly details
|
| 103 |
+
│ ├── Scenario-2/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
│ └── ... (15 scenarios total)
|
| 105 |
```
|
| 106 |
|
|
|
|
| 135 |
"account_id": "49tAGZz"
|
| 136 |
}
|
| 137 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
## Tasks
|
| 140 |
|
|
|
|
| 146 |
|
| 147 |
Identify the resource responsible for anomalous cost changes using synthetic cost anomaly details and workload configuration.
|
| 148 |
|
| 149 |
+
### CISO: Compliance Assessment (Coming Soon)
|
| 150 |
|
| 151 |
+
Generate the correct Kyverno policy (Kubernetes) or OPA policy (RHEL) based on regulatory rules and natural-language Kubernetes/RHEL configurations.
|
| 152 |
|
| 153 |
## Limitations
|
| 154 |
|
snapshots/ciso/v0.1/README-eval.md
DELETED
|
@@ -1,245 +0,0 @@
|
|
| 1 |
-
# Unified Evaluation Script for K8s OPA Static Analysis
|
| 2 |
-
|
| 3 |
-
## Overview
|
| 4 |
-
|
| 5 |
-
`eval.py` is a unified evaluation script that works for all K8s OPA static analysis scenarios. It eliminates the need for scenario-specific evaluation scripts by following a standardized evaluation process.
|
| 6 |
-
|
| 7 |
-
## How It Works
|
| 8 |
-
|
| 9 |
-
The evaluation process consists of 4 criteria:
|
| 10 |
-
|
| 11 |
-
1. **Required Files Exist** - Checks if `fetch.sh` and `policy.rego` exist in the agent's workdir
|
| 12 |
-
2. **Fetch Generates Data** - Executes `fetch.sh` and verifies `collected_data.json` is created
|
| 13 |
-
3. **Violation Detection** - Runs OPA to verify violations are detected (`data.check.result = false`)
|
| 14 |
-
4. **Compliance Validation** - Replaces resources with compliant versions and verifies compliance (`data.check.result = true`)
|
| 15 |
-
|
| 16 |
-
## Usage
|
| 17 |
-
|
| 18 |
-
```bash
|
| 19 |
-
python eval.py \
|
| 20 |
-
--agent-workdir <path-to-agent-workdir> \
|
| 21 |
-
--scenario-dir <path-to-scenario-dir> \
|
| 22 |
-
[--output <output-json-path>]
|
| 23 |
-
```
|
| 24 |
-
|
| 25 |
-
### Arguments
|
| 26 |
-
|
| 27 |
-
- `--agent-workdir`: Path to the agent's working directory containing:
|
| 28 |
-
- `fetch.sh` - Script to collect Kubernetes resources
|
| 29 |
-
- `policy.rego` - OPA policy for compliance checking
|
| 30 |
-
- `static-resources/` - Directory with Kubernetes resource YAML files (with violations)
|
| 31 |
-
|
| 32 |
-
- `--scenario-dir`: Path to the scenario directory containing:
|
| 33 |
-
- `static-resources-compliant/` - Directory with compliant Kubernetes resources
|
| 34 |
-
|
| 35 |
-
- `--output`: (Optional) Path to save JSON output. If not specified, outputs to stdout.
|
| 36 |
-
|
| 37 |
-
## Example
|
| 38 |
-
|
| 39 |
-
```bash
|
| 40 |
-
# Evaluate agent submission for CIS 5.2.6
|
| 41 |
-
python eval.py \
|
| 42 |
-
--agent-workdir /path/to/agent/workdir \
|
| 43 |
-
--scenario-dir itbench-lite/ciso/v0.1/k8s-opa-static-cis-5.2.6 \
|
| 44 |
-
--output results.json
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
## Output Format
|
| 48 |
-
|
| 49 |
-
The script outputs JSON with the following structure:
|
| 50 |
-
|
| 51 |
-
```json
|
| 52 |
-
{
|
| 53 |
-
"scores": [
|
| 54 |
-
{
|
| 55 |
-
"name": "required_files_exist",
|
| 56 |
-
"description": "Required files (fetch.sh and policy.rego) exist in agent workdir",
|
| 57 |
-
"pass": true,
|
| 58 |
-
"details": "All required files exist"
|
| 59 |
-
},
|
| 60 |
-
{
|
| 61 |
-
"name": "fetch_generates_data",
|
| 62 |
-
"description": "fetch.sh successfully generates collected_data.json",
|
| 63 |
-
"pass": true,
|
| 64 |
-
"details": "Exit code: 0; collected_data.json successfully generated"
|
| 65 |
-
},
|
| 66 |
-
{
|
| 67 |
-
"name": "violation_detection",
|
| 68 |
-
"description": "OPA policy correctly detects violations (data.check.result = false)",
|
| 69 |
-
"pass": true,
|
| 70 |
-
"details": "OPA result: false (expected: false for violation detection)"
|
| 71 |
-
},
|
| 72 |
-
{
|
| 73 |
-
"name": "compliance_validation",
|
| 74 |
-
"description": "OPA policy confirms compliance after using compliant resources (data.check.result = true)",
|
| 75 |
-
"pass": true,
|
| 76 |
-
"details": "OPA result: true (expected: true for compliance validation)"
|
| 77 |
-
}
|
| 78 |
-
],
|
| 79 |
-
"total_score": 4,
|
| 80 |
-
"max_score": 4,
|
| 81 |
-
"details": {
|
| 82 |
-
"temp_dir": "/tmp/eval_xyz123",
|
| 83 |
-
"work_path": "/tmp/eval_xyz123/workdir",
|
| 84 |
-
"violation_check_result": false,
|
| 85 |
-
"compliance_check_result": true,
|
| 86 |
-
"compliant_resources_replaced": true
|
| 87 |
-
}
|
| 88 |
-
}
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
### Score Fields
|
| 92 |
-
|
| 93 |
-
- `name`: Criterion identifier
|
| 94 |
-
- `description`: Human-readable description of what's being tested
|
| 95 |
-
- `pass`: Boolean indicating if the criterion passed
|
| 96 |
-
- `details`: Additional information about the test result
|
| 97 |
-
|
| 98 |
-
### Summary Fields
|
| 99 |
-
|
| 100 |
-
- `total_score`: Number of criteria that passed
|
| 101 |
-
- `max_score`: Total number of criteria (always 4)
|
| 102 |
-
- `details`: Additional debugging information
|
| 103 |
-
|
| 104 |
-
## Exit Codes
|
| 105 |
-
|
| 106 |
-
- `0`: All criteria passed
|
| 107 |
-
- `1`: One or more criteria failed
|
| 108 |
-
|
| 109 |
-
## Evaluation Process Details
|
| 110 |
-
|
| 111 |
-
### Step 1: Check Required Files
|
| 112 |
-
Verifies that both `fetch.sh` and `policy.rego` exist in the agent's workdir.
|
| 113 |
-
|
| 114 |
-
### Step 2: Create Temporary Environment
|
| 115 |
-
1. Creates a temporary directory
|
| 116 |
-
2. Copies the entire agent workdir to the temp directory
|
| 117 |
-
3. All subsequent operations happen in this isolated environment
|
| 118 |
-
|
| 119 |
-
### Step 3: Execute fetch.sh (Violation State)
|
| 120 |
-
1. Makes `fetch.sh` executable
|
| 121 |
-
2. Runs `fetch.sh` in the working directory
|
| 122 |
-
3. Verifies `collected_data.json` is created
|
| 123 |
-
4. Validates that the JSON is well-formed
|
| 124 |
-
|
| 125 |
-
### Step 4: OPA Violation Detection
|
| 126 |
-
1. Runs OPA evaluation: `opa eval -d policy.rego -i collected_data.json data.check.result`
|
| 127 |
-
2. Expects `data.check.result` to be `false` (violations detected)
|
| 128 |
-
|
| 129 |
-
### Step 5: Replace with Compliant Resources
|
| 130 |
-
1. Removes `static-resources/` directory
|
| 131 |
-
2. Copies `static-resources-compliant/` from scenario directory
|
| 132 |
-
3. This simulates the agent fixing the violations
|
| 133 |
-
|
| 134 |
-
### Step 6: Execute fetch.sh (Compliant State)
|
| 135 |
-
1. Removes old `collected_data.json`
|
| 136 |
-
2. Re-runs `fetch.sh` with compliant resources
|
| 137 |
-
3. Generates new `collected_data.json`
|
| 138 |
-
|
| 139 |
-
### Step 7: OPA Compliance Validation
|
| 140 |
-
1. Runs OPA evaluation again
|
| 141 |
-
2. Expects `data.check.result` to be `true` (no violations)
|
| 142 |
-
|
| 143 |
-
### Step 8: Cleanup
|
| 144 |
-
Removes the temporary directory and all its contents.
|
| 145 |
-
|
| 146 |
-
## Requirements
|
| 147 |
-
|
| 148 |
-
### System Requirements
|
| 149 |
-
- Python 3.7+
|
| 150 |
-
- Bash shell
|
| 151 |
-
- OPA (Open Policy Agent) CLI tool
|
| 152 |
-
|
| 153 |
-
### Agent Workdir Structure
|
| 154 |
-
```
|
| 155 |
-
agent-workdir/
|
| 156 |
-
├── fetch.sh # Required: Resource collection script
|
| 157 |
-
├── policy.rego # Required: OPA policy
|
| 158 |
-
└── static-resources/ # Required: K8s resources with violations
|
| 159 |
-
├── pods/
|
| 160 |
-
├── deployments/
|
| 161 |
-
└── ...
|
| 162 |
-
```
|
| 163 |
-
|
| 164 |
-
### Scenario Directory Structure
|
| 165 |
-
```
|
| 166 |
-
scenario-dir/
|
| 167 |
-
└── static-resources-compliant/ # Required: Compliant K8s resources
|
| 168 |
-
├── pods/
|
| 169 |
-
├── deployments/
|
| 170 |
-
└── ...
|
| 171 |
-
```
|
| 172 |
-
|
| 173 |
-
## Common Issues
|
| 174 |
-
|
| 175 |
-
### Issue: "OPA evaluation failed"
|
| 176 |
-
**Cause**: OPA CLI not installed or not in PATH
|
| 177 |
-
**Solution**: Install OPA: `brew install opa` (macOS) or download from https://www.openpolicyagent.org/
|
| 178 |
-
|
| 179 |
-
### Issue: "fetch.sh execution timed out"
|
| 180 |
-
**Cause**: fetch.sh takes longer than 60 seconds
|
| 181 |
-
**Solution**: Optimize fetch.sh or increase timeout in eval.py
|
| 182 |
-
|
| 183 |
-
### Issue: "static-resources-compliant not found"
|
| 184 |
-
**Cause**: Scenario directory doesn't have compliant resources yet
|
| 185 |
-
**Solution**: Run the agent prompt tasks to create `static-resources-compliant/` directories
|
| 186 |
-
|
| 187 |
-
### Issue: "collected_data.json is not valid JSON"
|
| 188 |
-
**Cause**: fetch.sh generates malformed JSON
|
| 189 |
-
**Solution**: Debug fetch.sh output, ensure proper JSON formatting
|
| 190 |
-
|
| 191 |
-
## Integration with ITBench
|
| 192 |
-
|
| 193 |
-
This evaluation script is designed to work with the ITBench orchestration system:
|
| 194 |
-
|
| 195 |
-
```yaml
|
| 196 |
-
# In scenario configuration
|
| 197 |
-
evaluation:
|
| 198 |
-
script: "../../eval.py"
|
| 199 |
-
args:
|
| 200 |
-
- "--agent-workdir"
|
| 201 |
-
- "{agent_workdir}"
|
| 202 |
-
- "--scenario-dir"
|
| 203 |
-
- "{scenario_dir}"
|
| 204 |
-
- "--output"
|
| 205 |
-
- "{output_path}"
|
| 206 |
-
```
|
| 207 |
-
|
| 208 |
-
## Advantages Over Scenario-Specific Scripts
|
| 209 |
-
|
| 210 |
-
1. **Single Source of Truth**: One script for all 15 scenarios
|
| 211 |
-
2. **Consistent Evaluation**: Same logic applied to all scenarios
|
| 212 |
-
3. **Easy Maintenance**: Bug fixes and improvements benefit all scenarios
|
| 213 |
-
4. **Reduced Code Duplication**: ~4,500-6,000 lines reduced to 449 lines
|
| 214 |
-
5. **Standardized Output**: Uniform JSON format across all scenarios
|
| 215 |
-
|
| 216 |
-
## Development
|
| 217 |
-
|
| 218 |
-
### Running Tests
|
| 219 |
-
```bash
|
| 220 |
-
# Test with a known-good agent submission
|
| 221 |
-
python eval.py \
|
| 222 |
-
--agent-workdir scenarios/k8s-opa-static/cis-5.2.6/results/test-success \
|
| 223 |
-
--scenario-dir itbench-lite/ciso/v0.1/k8s-opa-static-cis-5.2.6
|
| 224 |
-
```
|
| 225 |
-
|
| 226 |
-
### Adding Debug Output
|
| 227 |
-
Set environment variable for verbose output:
|
| 228 |
-
```bash
|
| 229 |
-
export DEBUG=1
|
| 230 |
-
python eval.py --agent-workdir ... --scenario-dir ...
|
| 231 |
-
```
|
| 232 |
-
|
| 233 |
-
## Related Files
|
| 234 |
-
|
| 235 |
-
- `eval-unified.py` - Previous version with violation-resources.yaml approach
|
| 236 |
-
- `agent-prompts/` - Prompts for creating static-resources-compliant directories
|
| 237 |
-
- `violation-resources.yaml` - Per-scenario configuration (legacy approach)
|
| 238 |
-
|
| 239 |
-
## Future Enhancements
|
| 240 |
-
|
| 241 |
-
- [ ] Add support for custom timeout values
|
| 242 |
-
- [ ] Add verbose/debug mode
|
| 243 |
-
- [ ] Support for partial credit scoring
|
| 244 |
-
- [ ] Integration with CI/CD pipelines
|
| 245 |
-
- [ ] HTML report generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/README.md
DELETED
|
@@ -1,183 +0,0 @@
|
|
| 1 |
-
# Kubernetes OPA Static Analysis Benchmark
|
| 2 |
-
|
| 3 |
-
This benchmark contains scenarios for testing AI agents' ability to create Open Policy Agent (OPA) policies for Kubernetes compliance checking.
|
| 4 |
-
|
| 5 |
-
## Prerequisites
|
| 6 |
-
|
| 7 |
-
Before running the benchmark scenarios, ensure you have the following installed:
|
| 8 |
-
|
| 9 |
-
### 1. Python Virtual Environment
|
| 10 |
-
|
| 11 |
-
Create and activate a Python virtual environment:
|
| 12 |
-
|
| 13 |
-
```bash
|
| 14 |
-
# Create virtual environment
|
| 15 |
-
python3 -m venv venv
|
| 16 |
-
|
| 17 |
-
# Activate virtual environment
|
| 18 |
-
# On macOS/Linux:
|
| 19 |
-
source venv/bin/activate
|
| 20 |
-
|
| 21 |
-
# On Windows:
|
| 22 |
-
venv\Scripts\activate
|
| 23 |
-
```
|
| 24 |
-
|
| 25 |
-
### 2. Install Python Dependencies
|
| 26 |
-
|
| 27 |
-
Install PyYAML in the virtual environment:
|
| 28 |
-
|
| 29 |
-
```bash
|
| 30 |
-
pip install PyYAML
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
### 3. Install OPA (Open Policy Agent)
|
| 34 |
-
|
| 35 |
-
Install OPA based on your operating system:
|
| 36 |
-
|
| 37 |
-
**macOS:**
|
| 38 |
-
```bash
|
| 39 |
-
brew install opa
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
**Linux:**
|
| 43 |
-
```bash
|
| 44 |
-
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64
|
| 45 |
-
chmod +x opa
|
| 46 |
-
sudo mv opa /usr/local/bin/
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
**Windows:**
|
| 50 |
-
```powershell
|
| 51 |
-
# Download from https://openpolicyagent.org/downloads/latest/opa_windows_amd64.exe
|
| 52 |
-
# Rename to opa.exe and add to PATH
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
**Verify Installation:**
|
| 56 |
-
```bash
|
| 57 |
-
opa version
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
Expected output: `Version: 1.0.0` (or later)
|
| 61 |
-
|
| 62 |
-
## Getting Started
|
| 63 |
-
|
| 64 |
-
### 1. Choose a Scenario
|
| 65 |
-
|
| 66 |
-
Select a scenario directory from the available options:
|
| 67 |
-
- `k8s-opa-static-cis-5.1.1` - Service Account Token Compliance
|
| 68 |
-
- `k8s-opa-static-cis-5.1.3` - Wildcard RBAC Permissions Check
|
| 69 |
-
- `k8s-opa-static-cis-5.1.5` - Default Service Account Usage Check
|
| 70 |
-
- `k8s-opa-static-cis-5.1.6` - Service Account Token Auto-mount Check
|
| 71 |
-
- `k8s-opa-static-cis-5.1.7` - Service Account Token Projection Check
|
| 72 |
-
- `k8s-opa-static-cis-5.2.2` - Privileged Container Check
|
| 73 |
-
- `k8s-opa-static-cis-5.2.3` - Host Namespace Sharing Check
|
| 74 |
-
- `k8s-opa-static-cis-5.2.4` - Host Network Sharing Check
|
| 75 |
-
- `k8s-opa-static-cis-5.2.5` - Privileged Escalation Check
|
| 76 |
-
- `k8s-opa-static-cis-5.2.6` - Root User Check
|
| 77 |
-
- `k8s-opa-static-cis-5.2.7` - NET_RAW Capability Check
|
| 78 |
-
- `k8s-opa-static-cis-5.2.8` - Capabilities Check
|
| 79 |
-
- `k8s-opa-static-cis-5.2.9` - Assigned Capabilities Check
|
| 80 |
-
- `k8s-opa-static-cis-5.7.3` - Image Pull Policy Check
|
| 81 |
-
- `k8s-opa-static-cis-5.7.4` - Namespace Quota Check
|
| 82 |
-
|
| 83 |
-
### 2. Set Up Agent Working Directory
|
| 84 |
-
|
| 85 |
-
Create a working directory and copy the necessary files:
|
| 86 |
-
|
| 87 |
-
```bash
|
| 88 |
-
# Create agent working directory
|
| 89 |
-
mkdir -p /tmp/agent-workdir
|
| 90 |
-
|
| 91 |
-
# Copy problem description
|
| 92 |
-
cp <scenario-dir>/problem.md /tmp/agent-workdir/
|
| 93 |
-
|
| 94 |
-
# Copy static resources
|
| 95 |
-
cp -r <scenario-dir>/static-resources-compliant /tmp/agent-workdir/static-resources-compliant
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
### 3. Run Your Agent
|
| 99 |
-
|
| 100 |
-
Provide the `problem.md` file to your AI agent as the goal. The agent should work in `/tmp/agent-workdir` to create:
|
| 101 |
-
- `fetch.sh` - Script to collect and process Kubernetes resource data
|
| 102 |
-
- `policy.rego` - OPA policy for compliance evaluation
|
| 103 |
-
|
| 104 |
-
The agent's solution should output `collected_data.json` when `fetch.sh` is executed, and the policy should be evaluable with OPA.
|
| 105 |
-
|
| 106 |
-
### 4. Evaluate the Solution
|
| 107 |
-
|
| 108 |
-
Run the evaluation script to check if the agent's solution is correct:
|
| 109 |
-
|
| 110 |
-
```bash
|
| 111 |
-
python eval.py --agent-workdir /tmp/agent-workdir --scenario-dir <scenario-dir>
|
| 112 |
-
```
|
| 113 |
-
|
| 114 |
-
## Example: Running Scenario k8s-opa-static-cis-5.1.1
|
| 115 |
-
|
| 116 |
-
```bash
|
| 117 |
-
# 1. Choose scenario
|
| 118 |
-
SCENARIO="k8s-opa-static-cis-5.1.1"
|
| 119 |
-
|
| 120 |
-
# 2. Set up working directory
|
| 121 |
-
mkdir -p /tmp/agent-workdir
|
| 122 |
-
cp ${SCENARIO}/problem.md /tmp/agent-workdir/
|
| 123 |
-
cp -r ${SCENARIO}/static-resources-compliant /tmp/agent-workdir/static-resources-compliant
|
| 124 |
-
|
| 125 |
-
# 3. Run your agent with problem.md in /tmp/agent-workdir
|
| 126 |
-
# (For testing purposes, you can copy the ground truth solution)
|
| 127 |
-
cp ${SCENARIO}/ground-truth/* /tmp/agent-workdir/
|
| 128 |
-
|
| 129 |
-
# 4. Evaluate
|
| 130 |
-
python eval.py --agent-workdir /tmp/agent-workdir --scenario-dir ${SCENARIO}
|
| 131 |
-
```
|
| 132 |
-
|
| 133 |
-
### Expected Evaluation Output
|
| 134 |
-
```bash
|
| 135 |
-
{
|
| 136 |
-
"scores": [
|
| 137 |
-
{
|
| 138 |
-
"name": "required_files_exist",
|
| 139 |
-
"description": "Required files (fetch.sh and policy.rego) exist in agent workdir",
|
| 140 |
-
"pass": true,
|
| 141 |
-
"details": "All required files exist"
|
| 142 |
-
},
|
| 143 |
-
{
|
| 144 |
-
"name": "fetch_generates_data",
|
| 145 |
-
"description": "fetch.sh successfully generates collected_data.json",
|
| 146 |
-
"pass": true,
|
| 147 |
-
"details": "Exit code: 0; collected_data.json successfully generated"
|
| 148 |
-
},
|
| 149 |
-
{
|
| 150 |
-
"name": "violation_detection",
|
| 151 |
-
"description": "OPA policy correctly detects violations (data.check.result = false)",
|
| 152 |
-
"pass": true,
|
| 153 |
-
"details": "OPA result: False (expected: false for violation detection)"
|
| 154 |
-
},
|
| 155 |
-
{
|
| 156 |
-
"name": "compliance_validation",
|
| 157 |
-
"description": "OPA policy confirms compliance after using compliant resources (data.check.result = true)",
|
| 158 |
-
"pass": true,
|
| 159 |
-
"details": "OPA result: True (expected: true for compliance validation)"
|
| 160 |
-
}
|
| 161 |
-
],
|
| 162 |
-
"total_score": 4,
|
| 163 |
-
"max_score": 4,
|
| 164 |
-
"details": {
|
| 165 |
-
"temp_dir": "/var/folders/yx/1mv5rdh53xd93bphsc459ht00000gn/T/eval_j3n6ielw",
|
| 166 |
-
"work_path": "/var/folders/yx/1mv5rdh53xd93bphsc459ht00000gn/T/eval_j3n6ielw/workdir",
|
| 167 |
-
"violation_check_result": false,
|
| 168 |
-
"compliant_resources_replaced": true,
|
| 169 |
-
"compliance_check_result": true
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
```
|
| 173 |
-
## Evaluation Criteria
|
| 174 |
-
|
| 175 |
-
The evaluation script checks:
|
| 176 |
-
- Whether `fetch.sh` and `policy.rego` exist
|
| 177 |
-
- Whether `fetch.sh` successfully generates `collected_data.json`
|
| 178 |
-
- Whether the OPA policy correctly identifies compliant resources
|
| 179 |
-
- Whether the OPA policy correctly identifies non-compliant resources
|
| 180 |
-
|
| 181 |
-
A successful solution should:
|
| 182 |
-
- Return `true` when evaluating compliant resources
|
| 183 |
-
- Return `false` when evaluating non-compliant resources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/eval.py
DELETED
|
@@ -1,463 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Evaluation Script for K8s OPA Static Analysis Scenarios
|
| 4 |
-
|
| 5 |
-
This script evaluates agent submissions by:
|
| 6 |
-
1. Checking required files exist (fetch.sh, policy.rego)
|
| 7 |
-
2. Running fetch.sh to generate collected_data.json
|
| 8 |
-
3. Verifying OPA detects violations (data.check.result = false)
|
| 9 |
-
4. Replacing static-resources with compliant version
|
| 10 |
-
5. Verifying OPA confirms compliance (data.check.result = true)
|
| 11 |
-
|
| 12 |
-
Usage:
|
| 13 |
-
python eval.py --agent-workdir <path> --scenario-dir <path> [--output <path>]
|
| 14 |
-
"""
|
| 15 |
-
|
| 16 |
-
import argparse
|
| 17 |
-
import json
|
| 18 |
-
import os
|
| 19 |
-
import shutil
|
| 20 |
-
import subprocess
|
| 21 |
-
import sys
|
| 22 |
-
import tempfile
|
| 23 |
-
from pathlib import Path
|
| 24 |
-
from typing import Dict, List, Any, Optional
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
class EvaluationCriteria:
|
| 28 |
-
"""Evaluation criteria definitions"""
|
| 29 |
-
|
| 30 |
-
CRITERIA_1 = {
|
| 31 |
-
"name": "required_files_exist",
|
| 32 |
-
"description": "Required files (fetch.sh and policy.rego) exist in agent workdir"
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
CRITERIA_2 = {
|
| 36 |
-
"name": "fetch_generates_data",
|
| 37 |
-
"description": "fetch.sh successfully generates collected_data.json"
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
CRITERIA_3 = {
|
| 41 |
-
"name": "violation_detection",
|
| 42 |
-
"description": "OPA policy correctly detects violations (data.check.result = false)"
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
CRITERIA_4 = {
|
| 46 |
-
"name": "compliance_validation",
|
| 47 |
-
"description": "OPA policy confirms compliance after using compliant resources (data.check.result = true)"
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
class EvaluationResult:
|
| 52 |
-
"""Container for evaluation results"""
|
| 53 |
-
|
| 54 |
-
def __init__(self):
|
| 55 |
-
self.scores: List[Dict[str, Any]] = []
|
| 56 |
-
self.total_score: int = 0
|
| 57 |
-
self.details: Dict[str, Any] = {}
|
| 58 |
-
|
| 59 |
-
def add_score(self, name: str, description: str, passed: bool, details: str = ""):
|
| 60 |
-
"""Add a criterion score"""
|
| 61 |
-
self.scores.append({
|
| 62 |
-
"name": name,
|
| 63 |
-
"description": description,
|
| 64 |
-
"pass": passed,
|
| 65 |
-
"details": details
|
| 66 |
-
})
|
| 67 |
-
if passed:
|
| 68 |
-
self.total_score += 1
|
| 69 |
-
|
| 70 |
-
def to_dict(self) -> Dict[str, Any]:
|
| 71 |
-
"""Convert to dictionary for JSON output"""
|
| 72 |
-
return {
|
| 73 |
-
"scores": self.scores,
|
| 74 |
-
"total_score": self.total_score,
|
| 75 |
-
"max_score": len(self.scores),
|
| 76 |
-
"details": self.details
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
def to_json(self, indent: int = 2) -> str:
|
| 80 |
-
"""Convert to JSON string"""
|
| 81 |
-
return json.dumps(self.to_dict(), indent=indent)
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
class Evaluator:
|
| 85 |
-
"""Main evaluator class"""
|
| 86 |
-
|
| 87 |
-
def __init__(self, agent_workdir: Path, scenario_dir: Path, output_path: Optional[Path] = None):
|
| 88 |
-
self.agent_workdir = Path(agent_workdir).resolve()
|
| 89 |
-
self.scenario_dir = Path(scenario_dir).resolve()
|
| 90 |
-
self.output_path = output_path
|
| 91 |
-
self.temp_dir = None
|
| 92 |
-
self.result = EvaluationResult()
|
| 93 |
-
|
| 94 |
-
def evaluate(self) -> EvaluationResult:
|
| 95 |
-
"""Run all evaluation criteria"""
|
| 96 |
-
try:
|
| 97 |
-
# Criterion 1: Check required files exist
|
| 98 |
-
self._evaluate_required_files()
|
| 99 |
-
|
| 100 |
-
# Create temporary directory and copy agent workdir
|
| 101 |
-
self._setup_temp_directory()
|
| 102 |
-
|
| 103 |
-
# Criterion 2: Run fetch.sh and check collected_data.json
|
| 104 |
-
self._evaluate_fetch_execution()
|
| 105 |
-
|
| 106 |
-
# Criterion 3: Verify OPA detects violations
|
| 107 |
-
self._evaluate_violation_detection()
|
| 108 |
-
|
| 109 |
-
# Replace static-resources with compliant version
|
| 110 |
-
self._replace_with_compliant_resources()
|
| 111 |
-
|
| 112 |
-
# Criterion 4: Verify OPA confirms compliance
|
| 113 |
-
self._evaluate_compliance_validation()
|
| 114 |
-
|
| 115 |
-
except Exception as e:
|
| 116 |
-
self.result.details["error"] = str(e)
|
| 117 |
-
print(f"Error during evaluation: {e}", file=sys.stderr)
|
| 118 |
-
|
| 119 |
-
finally:
|
| 120 |
-
# Cleanup temporary directory
|
| 121 |
-
self._cleanup()
|
| 122 |
-
|
| 123 |
-
return self.result
|
| 124 |
-
|
| 125 |
-
def _evaluate_required_files(self):
|
| 126 |
-
"""Criterion 1: Check if fetch.sh and policy.rego exist"""
|
| 127 |
-
fetch_sh = self.agent_workdir / "fetch.sh"
|
| 128 |
-
policy_rego = self.agent_workdir / "policy.rego"
|
| 129 |
-
|
| 130 |
-
fetch_exists = fetch_sh.exists() and fetch_sh.is_file()
|
| 131 |
-
policy_exists = policy_rego.exists() and policy_rego.is_file()
|
| 132 |
-
|
| 133 |
-
passed = fetch_exists and policy_exists
|
| 134 |
-
|
| 135 |
-
details = []
|
| 136 |
-
if not fetch_exists:
|
| 137 |
-
details.append(f"fetch.sh not found at {fetch_sh}")
|
| 138 |
-
if not policy_exists:
|
| 139 |
-
details.append(f"policy.rego not found at {policy_rego}")
|
| 140 |
-
|
| 141 |
-
self.result.add_score(
|
| 142 |
-
EvaluationCriteria.CRITERIA_1["name"],
|
| 143 |
-
EvaluationCriteria.CRITERIA_1["description"],
|
| 144 |
-
passed,
|
| 145 |
-
"; ".join(details) if details else "All required files exist"
|
| 146 |
-
)
|
| 147 |
-
|
| 148 |
-
def _setup_temp_directory(self):
|
| 149 |
-
"""Create temporary directory and copy agent workdir"""
|
| 150 |
-
self.temp_dir = Path(tempfile.mkdtemp(prefix="eval_"))
|
| 151 |
-
|
| 152 |
-
# Copy entire agent workdir to temp directory
|
| 153 |
-
shutil.copytree(self.agent_workdir, self.temp_dir / "workdir")
|
| 154 |
-
self.work_path = self.temp_dir / "workdir"
|
| 155 |
-
|
| 156 |
-
# Copy static-resources from scenario_dir to work_path
|
| 157 |
-
scenario_static_resources = self.scenario_dir / "static-resources"
|
| 158 |
-
if scenario_static_resources.exists():
|
| 159 |
-
work_static_resources = self.work_path / "static-resources"
|
| 160 |
-
if work_static_resources.exists():
|
| 161 |
-
shutil.rmtree(work_static_resources)
|
| 162 |
-
shutil.copytree(scenario_static_resources, work_static_resources)
|
| 163 |
-
|
| 164 |
-
self.result.details["temp_dir"] = str(self.temp_dir)
|
| 165 |
-
self.result.details["work_path"] = str(self.work_path)
|
| 166 |
-
|
| 167 |
-
def _evaluate_fetch_execution(self):
|
| 168 |
-
"""Criterion 2: Execute fetch.sh and check if collected_data.json is generated"""
|
| 169 |
-
fetch_sh = self.work_path / "fetch.sh"
|
| 170 |
-
collected_data = self.work_path / "collected_data.json"
|
| 171 |
-
|
| 172 |
-
# Remove existing collected_data.json if present
|
| 173 |
-
if collected_data.exists():
|
| 174 |
-
collected_data.unlink()
|
| 175 |
-
|
| 176 |
-
try:
|
| 177 |
-
# Make fetch.sh executable
|
| 178 |
-
os.chmod(fetch_sh, 0o755)
|
| 179 |
-
|
| 180 |
-
# Execute fetch.sh
|
| 181 |
-
result = subprocess.run(
|
| 182 |
-
["bash", str(fetch_sh)],
|
| 183 |
-
cwd=self.work_path,
|
| 184 |
-
capture_output=True,
|
| 185 |
-
text=True,
|
| 186 |
-
timeout=60
|
| 187 |
-
)
|
| 188 |
-
|
| 189 |
-
# Check if collected_data.json was created
|
| 190 |
-
data_exists = collected_data.exists() and collected_data.is_file()
|
| 191 |
-
|
| 192 |
-
# Try to parse JSON to ensure it's valid
|
| 193 |
-
valid_json = False
|
| 194 |
-
if data_exists:
|
| 195 |
-
try:
|
| 196 |
-
with open(collected_data, 'r') as f:
|
| 197 |
-
json.load(f)
|
| 198 |
-
valid_json = True
|
| 199 |
-
except json.JSONDecodeError as e:
|
| 200 |
-
self.result.details["fetch_json_error"] = str(e)
|
| 201 |
-
|
| 202 |
-
passed = result.returncode == 0 and data_exists and valid_json
|
| 203 |
-
|
| 204 |
-
details = f"Exit code: {result.returncode}"
|
| 205 |
-
if not data_exists:
|
| 206 |
-
details += "; collected_data.json not created"
|
| 207 |
-
elif not valid_json:
|
| 208 |
-
details += "; collected_data.json is not valid JSON"
|
| 209 |
-
else:
|
| 210 |
-
details += "; collected_data.json successfully generated"
|
| 211 |
-
|
| 212 |
-
if result.stderr:
|
| 213 |
-
self.result.details["fetch_stderr"] = result.stderr
|
| 214 |
-
|
| 215 |
-
self.result.add_score(
|
| 216 |
-
EvaluationCriteria.CRITERIA_2["name"],
|
| 217 |
-
EvaluationCriteria.CRITERIA_2["description"],
|
| 218 |
-
passed,
|
| 219 |
-
details
|
| 220 |
-
)
|
| 221 |
-
|
| 222 |
-
except subprocess.TimeoutExpired:
|
| 223 |
-
self.result.add_score(
|
| 224 |
-
EvaluationCriteria.CRITERIA_2["name"],
|
| 225 |
-
EvaluationCriteria.CRITERIA_2["description"],
|
| 226 |
-
False,
|
| 227 |
-
"fetch.sh execution timed out (60s)"
|
| 228 |
-
)
|
| 229 |
-
except Exception as e:
|
| 230 |
-
self.result.add_score(
|
| 231 |
-
EvaluationCriteria.CRITERIA_2["name"],
|
| 232 |
-
EvaluationCriteria.CRITERIA_2["description"],
|
| 233 |
-
False,
|
| 234 |
-
f"Error executing fetch.sh: {str(e)}"
|
| 235 |
-
)
|
| 236 |
-
|
| 237 |
-
def _evaluate_violation_detection(self):
|
| 238 |
-
"""Criterion 3: Verify OPA detects violations (data.check.result = false)"""
|
| 239 |
-
policy_rego = self.work_path / "policy.rego"
|
| 240 |
-
collected_data = self.work_path / "collected_data.json"
|
| 241 |
-
|
| 242 |
-
if not collected_data.exists():
|
| 243 |
-
self.result.add_score(
|
| 244 |
-
EvaluationCriteria.CRITERIA_3["name"],
|
| 245 |
-
EvaluationCriteria.CRITERIA_3["description"],
|
| 246 |
-
False,
|
| 247 |
-
"collected_data.json does not exist"
|
| 248 |
-
)
|
| 249 |
-
return
|
| 250 |
-
|
| 251 |
-
try:
|
| 252 |
-
# Run OPA evaluation
|
| 253 |
-
result = subprocess.run(
|
| 254 |
-
["opa", "eval", "-d", str(policy_rego), "-i", str(collected_data),
|
| 255 |
-
"data.check.result", "--format", "json"],
|
| 256 |
-
capture_output=True,
|
| 257 |
-
text=True,
|
| 258 |
-
timeout=30
|
| 259 |
-
)
|
| 260 |
-
|
| 261 |
-
if result.returncode != 0:
|
| 262 |
-
self.result.add_score(
|
| 263 |
-
EvaluationCriteria.CRITERIA_3["name"],
|
| 264 |
-
EvaluationCriteria.CRITERIA_3["description"],
|
| 265 |
-
False,
|
| 266 |
-
f"OPA evaluation failed: {result.stderr}"
|
| 267 |
-
)
|
| 268 |
-
return
|
| 269 |
-
|
| 270 |
-
# Parse OPA output
|
| 271 |
-
opa_output = json.loads(result.stdout)
|
| 272 |
-
check_result = opa_output.get("result", [{}])[0].get("expressions", [{}])[0].get("value")
|
| 273 |
-
|
| 274 |
-
# For violation detection, we expect result to be false
|
| 275 |
-
passed = check_result is False
|
| 276 |
-
|
| 277 |
-
details = f"OPA result: {check_result} (expected: false for violation detection)"
|
| 278 |
-
self.result.details["violation_check_result"] = check_result
|
| 279 |
-
|
| 280 |
-
self.result.add_score(
|
| 281 |
-
EvaluationCriteria.CRITERIA_3["name"],
|
| 282 |
-
EvaluationCriteria.CRITERIA_3["description"],
|
| 283 |
-
passed,
|
| 284 |
-
details
|
| 285 |
-
)
|
| 286 |
-
|
| 287 |
-
except subprocess.TimeoutExpired:
|
| 288 |
-
self.result.add_score(
|
| 289 |
-
EvaluationCriteria.CRITERIA_3["name"],
|
| 290 |
-
EvaluationCriteria.CRITERIA_3["description"],
|
| 291 |
-
False,
|
| 292 |
-
"OPA evaluation timed out (30s)"
|
| 293 |
-
)
|
| 294 |
-
except Exception as e:
|
| 295 |
-
self.result.add_score(
|
| 296 |
-
EvaluationCriteria.CRITERIA_3["name"],
|
| 297 |
-
EvaluationCriteria.CRITERIA_3["description"],
|
| 298 |
-
False,
|
| 299 |
-
f"Error during OPA evaluation: {str(e)}"
|
| 300 |
-
)
|
| 301 |
-
|
| 302 |
-
def _replace_with_compliant_resources(self):
|
| 303 |
-
"""Replace static-resources with static-resources-compliant from scenario dir"""
|
| 304 |
-
static_resources = self.work_path / "static-resources"
|
| 305 |
-
compliant_resources = self.scenario_dir / "static-resources-compliant"
|
| 306 |
-
|
| 307 |
-
if not compliant_resources.exists():
|
| 308 |
-
self.result.details["warning"] = f"static-resources-compliant not found in {self.scenario_dir}"
|
| 309 |
-
return
|
| 310 |
-
|
| 311 |
-
# Remove existing static-resources
|
| 312 |
-
if static_resources.exists():
|
| 313 |
-
shutil.rmtree(static_resources)
|
| 314 |
-
|
| 315 |
-
# Copy compliant resources
|
| 316 |
-
shutil.copytree(compliant_resources, static_resources)
|
| 317 |
-
|
| 318 |
-
self.result.details["compliant_resources_replaced"] = True
|
| 319 |
-
|
| 320 |
-
def _evaluate_compliance_validation(self):
|
| 321 |
-
"""Criterion 4: Verify OPA confirms compliance (data.check.result = true)"""
|
| 322 |
-
fetch_sh = self.work_path / "fetch.sh"
|
| 323 |
-
policy_rego = self.work_path / "policy.rego"
|
| 324 |
-
collected_data = self.work_path / "collected_data.json"
|
| 325 |
-
|
| 326 |
-
# Remove existing collected_data.json
|
| 327 |
-
if collected_data.exists():
|
| 328 |
-
collected_data.unlink()
|
| 329 |
-
|
| 330 |
-
try:
|
| 331 |
-
# Re-run fetch.sh with compliant resources
|
| 332 |
-
os.chmod(fetch_sh, 0o755)
|
| 333 |
-
result = subprocess.run(
|
| 334 |
-
["bash", str(fetch_sh)],
|
| 335 |
-
cwd=self.work_path,
|
| 336 |
-
capture_output=True,
|
| 337 |
-
text=True,
|
| 338 |
-
timeout=60
|
| 339 |
-
)
|
| 340 |
-
|
| 341 |
-
if result.returncode != 0 or not collected_data.exists():
|
| 342 |
-
self.result.add_score(
|
| 343 |
-
EvaluationCriteria.CRITERIA_4["name"],
|
| 344 |
-
EvaluationCriteria.CRITERIA_4["description"],
|
| 345 |
-
False,
|
| 346 |
-
f"fetch.sh failed after replacing with compliant resources"
|
| 347 |
-
)
|
| 348 |
-
return
|
| 349 |
-
|
| 350 |
-
# Run OPA evaluation
|
| 351 |
-
result = subprocess.run(
|
| 352 |
-
["opa", "eval", "-d", str(policy_rego), "-i", str(collected_data),
|
| 353 |
-
"data.check.result", "--format", "json"],
|
| 354 |
-
capture_output=True,
|
| 355 |
-
text=True,
|
| 356 |
-
timeout=30
|
| 357 |
-
)
|
| 358 |
-
|
| 359 |
-
if result.returncode != 0:
|
| 360 |
-
self.result.add_score(
|
| 361 |
-
EvaluationCriteria.CRITERIA_4["name"],
|
| 362 |
-
EvaluationCriteria.CRITERIA_4["description"],
|
| 363 |
-
False,
|
| 364 |
-
f"OPA evaluation failed: {result.stderr}"
|
| 365 |
-
)
|
| 366 |
-
return
|
| 367 |
-
|
| 368 |
-
# Parse OPA output
|
| 369 |
-
opa_output = json.loads(result.stdout)
|
| 370 |
-
check_result = opa_output.get("result", [{}])[0].get("expressions", [{}])[0].get("value")
|
| 371 |
-
|
| 372 |
-
# For compliance validation, we expect result to be true
|
| 373 |
-
passed = check_result is True
|
| 374 |
-
|
| 375 |
-
details = f"OPA result: {check_result} (expected: true for compliance validation)"
|
| 376 |
-
self.result.details["compliance_check_result"] = check_result
|
| 377 |
-
|
| 378 |
-
self.result.add_score(
|
| 379 |
-
EvaluationCriteria.CRITERIA_4["name"],
|
| 380 |
-
EvaluationCriteria.CRITERIA_4["description"],
|
| 381 |
-
passed,
|
| 382 |
-
details
|
| 383 |
-
)
|
| 384 |
-
|
| 385 |
-
except subprocess.TimeoutExpired:
|
| 386 |
-
self.result.add_score(
|
| 387 |
-
EvaluationCriteria.CRITERIA_4["name"],
|
| 388 |
-
EvaluationCriteria.CRITERIA_4["description"],
|
| 389 |
-
False,
|
| 390 |
-
"Execution timed out during compliance validation"
|
| 391 |
-
)
|
| 392 |
-
except Exception as e:
|
| 393 |
-
self.result.add_score(
|
| 394 |
-
EvaluationCriteria.CRITERIA_4["name"],
|
| 395 |
-
EvaluationCriteria.CRITERIA_4["description"],
|
| 396 |
-
False,
|
| 397 |
-
f"Error during compliance validation: {str(e)}"
|
| 398 |
-
)
|
| 399 |
-
|
| 400 |
-
def _cleanup(self):
|
| 401 |
-
"""Clean up temporary directory"""
|
| 402 |
-
if self.temp_dir and self.temp_dir.exists():
|
| 403 |
-
try:
|
| 404 |
-
shutil.rmtree(self.temp_dir)
|
| 405 |
-
except Exception as e:
|
| 406 |
-
print(f"Warning: Failed to cleanup temp directory: {e}", file=sys.stderr)
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
def main():
|
| 410 |
-
parser = argparse.ArgumentParser(
|
| 411 |
-
description="Unified evaluation script for K8s OPA static analysis scenarios"
|
| 412 |
-
)
|
| 413 |
-
parser.add_argument(
|
| 414 |
-
"--agent-workdir",
|
| 415 |
-
required=True,
|
| 416 |
-
help="Path to agent's working directory containing fetch.sh and policy.rego"
|
| 417 |
-
)
|
| 418 |
-
parser.add_argument(
|
| 419 |
-
"--scenario-dir",
|
| 420 |
-
required=True,
|
| 421 |
-
help="Path to scenario directory containing static-resources-compliant"
|
| 422 |
-
)
|
| 423 |
-
parser.add_argument(
|
| 424 |
-
"--output",
|
| 425 |
-
help="Path to output JSON file (default: stdout)"
|
| 426 |
-
)
|
| 427 |
-
|
| 428 |
-
args = parser.parse_args()
|
| 429 |
-
|
| 430 |
-
# Validate paths
|
| 431 |
-
agent_workdir = Path(args.agent_workdir)
|
| 432 |
-
scenario_dir = Path(args.scenario_dir)
|
| 433 |
-
|
| 434 |
-
if not agent_workdir.exists():
|
| 435 |
-
print(f"Error: Agent workdir does not exist: {agent_workdir}", file=sys.stderr)
|
| 436 |
-
sys.exit(1)
|
| 437 |
-
|
| 438 |
-
if not scenario_dir.exists():
|
| 439 |
-
print(f"Error: Scenario dir does not exist: {scenario_dir}", file=sys.stderr)
|
| 440 |
-
sys.exit(1)
|
| 441 |
-
|
| 442 |
-
# Run evaluation
|
| 443 |
-
evaluator = Evaluator(agent_workdir, scenario_dir, args.output)
|
| 444 |
-
result = evaluator.evaluate()
|
| 445 |
-
|
| 446 |
-
# Output results
|
| 447 |
-
json_output = result.to_json()
|
| 448 |
-
|
| 449 |
-
if args.output:
|
| 450 |
-
output_path = Path(args.output)
|
| 451 |
-
output_path.parent.mkdir(parents=True, exist_ok=True)
|
| 452 |
-
with open(output_path, 'w') as f:
|
| 453 |
-
f.write(json_output)
|
| 454 |
-
print(f"Results written to {output_path}")
|
| 455 |
-
else:
|
| 456 |
-
print(json_output)
|
| 457 |
-
|
| 458 |
-
# Exit with appropriate code
|
| 459 |
-
sys.exit(0 if result.total_score == len(result.scores) else 1)
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
if __name__ == "__main__":
|
| 463 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/collected_data.json
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"serviceaccounts": [],
|
| 3 |
-
"roles": [],
|
| 4 |
-
"rolebindings": []
|
| 5 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/fetch.sh
DELETED
|
@@ -1,68 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
set -e
|
| 3 |
-
|
| 4 |
-
# Path to static resources
|
| 5 |
-
RESOURCES_DIR="./static-resources"
|
| 6 |
-
|
| 7 |
-
# Initialize JSON structure
|
| 8 |
-
echo '{"serviceaccounts": [], "roles": [], "rolebindings": []}' > collected_data.json
|
| 9 |
-
|
| 10 |
-
# Function to parse YAML and extract relevant fields
|
| 11 |
-
parse_resources() {
|
| 12 |
-
local kind=$1
|
| 13 |
-
local dir="${RESOURCES_DIR}/${kind}"
|
| 14 |
-
|
| 15 |
-
if [ ! -d "$dir" ]; then
|
| 16 |
-
return
|
| 17 |
-
fi
|
| 18 |
-
|
| 19 |
-
# Use yq or python to parse YAML files and build JSON array
|
| 20 |
-
python3 <<PYTHON
|
| 21 |
-
import json
|
| 22 |
-
import yaml
|
| 23 |
-
import os
|
| 24 |
-
import sys
|
| 25 |
-
|
| 26 |
-
resources = []
|
| 27 |
-
resource_dir = "${dir}"
|
| 28 |
-
|
| 29 |
-
if os.path.exists(resource_dir):
|
| 30 |
-
for filename in os.listdir(resource_dir):
|
| 31 |
-
if filename.endswith('.yaml'):
|
| 32 |
-
filepath = os.path.join(resource_dir, filename)
|
| 33 |
-
with open(filepath, 'r') as f:
|
| 34 |
-
try:
|
| 35 |
-
resource = yaml.safe_load(f)
|
| 36 |
-
if resource:
|
| 37 |
-
resources.append(resource)
|
| 38 |
-
except Exception as e:
|
| 39 |
-
print(f"Error parsing {filepath}: {e}", file=sys.stderr)
|
| 40 |
-
|
| 41 |
-
print(json.dumps(resources, indent=2))
|
| 42 |
-
PYTHON
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
# Collect all resources
|
| 46 |
-
SA_DATA=$(parse_resources "serviceaccounts")
|
| 47 |
-
ROLE_DATA=$(parse_resources "roles")
|
| 48 |
-
RB_DATA=$(parse_resources "rolebindings")
|
| 49 |
-
|
| 50 |
-
# Build final JSON
|
| 51 |
-
python3 <<PYTHON
|
| 52 |
-
import json
|
| 53 |
-
|
| 54 |
-
sa_data = ${SA_DATA:-[]}
|
| 55 |
-
role_data = ${ROLE_DATA:-[]}
|
| 56 |
-
rb_data = ${RB_DATA:-[]}
|
| 57 |
-
|
| 58 |
-
output = {
|
| 59 |
-
"serviceaccounts": sa_data,
|
| 60 |
-
"roles": role_data,
|
| 61 |
-
"rolebindings": rb_data
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
with open('collected_data.json', 'w') as f:
|
| 65 |
-
json.dump(output, f, indent=2)
|
| 66 |
-
PYTHON
|
| 67 |
-
|
| 68 |
-
echo "Data collection complete. Output: collected_data.json"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/ground-truth/policy.rego
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
package check
|
| 2 |
-
|
| 3 |
-
import rego.v1
|
| 4 |
-
|
| 5 |
-
# Default result is true (compliant)
|
| 6 |
-
default result := true
|
| 7 |
-
|
| 8 |
-
# Check for violations: Direct cluster-admin ClusterRole usage
|
| 9 |
-
result := false if {
|
| 10 |
-
some rb in input.rolebindings
|
| 11 |
-
|
| 12 |
-
# Check if binding references cluster-admin ClusterRole
|
| 13 |
-
rb.roleRef.kind == "ClusterRole"
|
| 14 |
-
rb.roleRef.name == "cluster-admin"
|
| 15 |
-
|
| 16 |
-
# Check if bound to a ServiceAccount
|
| 17 |
-
some subject in rb.subjects
|
| 18 |
-
subject.kind == "ServiceAccount"
|
| 19 |
-
|
| 20 |
-
# Exclude benchmark system accounts
|
| 21 |
-
not startswith(subject.name, "benchmark-")
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
# Check for violations: ServiceAccounts with wildcard role permissions
|
| 25 |
-
result := false if {
|
| 26 |
-
some rb in input.rolebindings
|
| 27 |
-
some role in input.roles
|
| 28 |
-
|
| 29 |
-
# Match RoleBinding to Role
|
| 30 |
-
rb.roleRef.kind == "Role"
|
| 31 |
-
rb.roleRef.name == role.metadata.name
|
| 32 |
-
|
| 33 |
-
# Check if Role has wildcard permissions
|
| 34 |
-
has_wildcard_permissions(role)
|
| 35 |
-
|
| 36 |
-
# Check if bound to a ServiceAccount
|
| 37 |
-
some subject in rb.subjects
|
| 38 |
-
subject.kind == "ServiceAccount"
|
| 39 |
-
|
| 40 |
-
# Exclude benchmark system accounts
|
| 41 |
-
not startswith(subject.name, "benchmark-")
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
# Helper function to check for wildcard permissions
|
| 45 |
-
has_wildcard_permissions(role) if {
|
| 46 |
-
some rule in role.rules
|
| 47 |
-
"*" in rule.apiGroups
|
| 48 |
-
"*" in rule.resources
|
| 49 |
-
"*" in rule.verbs
|
| 50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/problem.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
# Problem: Detect cluster-admin Role Usage in Kubernetes Resources
|
| 2 |
-
|
| 3 |
-
## Objective
|
| 4 |
-
|
| 5 |
-
Create a fetcher script and OPA policy to detect compliance violations related to cluster-admin role usage in Kubernetes namespace-scoped resources.
|
| 6 |
-
|
| 7 |
-
## Compliance Requirement
|
| 8 |
-
|
| 9 |
-
**CIS Benchmark 5.1.1**: The cluster-admin role should not be used by any service account.
|
| 10 |
-
|
| 11 |
-
In this scenario, we define "cluster-admin-like" permissions as:
|
| 12 |
-
- Roles with wildcard permissions: `apiGroups: ["*"]`, `resources: ["*"]`, `verbs: ["*"]`
|
| 13 |
-
- ServiceAccounts bound to such roles via RoleBindings
|
| 14 |
-
|
| 15 |
-
## Exception
|
| 16 |
-
|
| 17 |
-
One service account is used by the benchmark system itself and has wildcard permissions for operational purposes. This account should be **excluded** from violation detection:
|
| 18 |
-
- ServiceAccount name: `benchmark-admin-sa`
|
| 19 |
-
|
| 20 |
-
## Task
|
| 21 |
-
|
| 22 |
-
You need to create two files:
|
| 23 |
-
|
| 24 |
-
1. **fetch.sh** - A script that collects and processes Kubernetes resource data from the static resources directory
|
| 25 |
-
2. **policy.rego** - An OPA (Open Policy Agent) policy that evaluates the collected data for compliance violations
|
| 26 |
-
|
| 27 |
-
## Static Resources
|
| 28 |
-
|
| 29 |
-
Pre-collected Kubernetes resources are available in the directory:
|
| 30 |
-
- Path: `./static-resources`
|
| 31 |
-
- Namespace: `k8s-opa-static-cis-511`
|
| 32 |
-
|
| 33 |
-
The directory contains YAML files organized by resource type:
|
| 34 |
-
- serviceaccounts/
|
| 35 |
-
- roles/
|
| 36 |
-
- rolebindings/
|
| 37 |
-
- pods/
|
| 38 |
-
- deployments/
|
| 39 |
-
- replicasets/
|
| 40 |
-
- services/
|
| 41 |
-
- configmaps/
|
| 42 |
-
|
| 43 |
-
## Requirements
|
| 44 |
-
|
| 45 |
-
### fetch.sh Requirements
|
| 46 |
-
- Read and process resources from the static resources directory
|
| 47 |
-
- Output collected data to a file named `collected_data.json`
|
| 48 |
-
- The output should be in JSON format suitable for OPA evaluation
|
| 49 |
-
|
| 50 |
-
### policy.rego Requirements
|
| 51 |
-
- Package name: `package check`
|
| 52 |
-
- Define a boolean field named `result`
|
| 53 |
-
- Return `false` when violations are detected
|
| 54 |
-
- Return `true` when the system is compliant
|
| 55 |
-
- Exclude the benchmark system service account (`benchmark-admin-sa`) from violation checks
|
| 56 |
-
|
| 57 |
-
### Evaluation Method
|
| 58 |
-
Your solution will be evaluated using:
|
| 59 |
-
```bash
|
| 60 |
-
./fetch.sh
|
| 61 |
-
cat collected_data.json | opa eval -d policy.rego -I 'data.check.result'
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
## Expected Behavior
|
| 65 |
-
|
| 66 |
-
- **Initial state** (with violations): The evaluation should return `false`
|
| 67 |
-
- **After removing violations**: The evaluation should return `true`
|
| 68 |
-
- **Benchmark system account**: Should never be flagged as a violation
|
| 69 |
-
|
| 70 |
-
## Notes
|
| 71 |
-
|
| 72 |
-
- OPA version: 1.0.0
|
| 73 |
-
- All resources are namespace-scoped (no cluster-level resources)
|
| 74 |
-
- Focus on detecting RoleBindings that grant wildcard permissions to ServiceAccounts
|
| 75 |
-
- Remember to exclude the benchmark system account from your violation detection logic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/configmaps/kube-root-ca.crt.yaml
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
data:
|
| 3 |
-
ca.crt: |
|
| 4 |
-
-----BEGIN CERTIFICATE-----
|
| 5 |
-
MIIDBTCCAe2gAwIBAgIIUAOla/7ups4wDQYJKoZIhvcNAQELBQAwFTETMBEGA1UE
|
| 6 |
-
AxMKa3ViZXJuZXRlczAeFw0yNjAyMjQwNTQzMTVaFw0zNjAyMjIwNTQ4MTVaMBUx
|
| 7 |
-
EzARBgNVBAMTCmt1YmVybmV0ZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
| 8 |
-
AoIBAQDQZNy0hQ3zl5/RVSHLpdu6fvGiGqQPGHujHphY3B7kcKmE6G7gSWQfIWzp
|
| 9 |
-
HsFQ2vXRGHfhS5rJDAwPAiEEIoWz7FN+ibpvjyj91NNidHP4LrDVZyhJHFxjB2Lw
|
| 10 |
-
xy1Mw6ok5ZONsHZ7KcW6pKonSM176tzktiirNbFFcaTc02xFyWEbuyrXbSm9NraX
|
| 11 |
-
dw5q9bfPjJXAyy9o3Ymh5TGpFmU/OpLpcpiZqQ6uPNHaU63T8qevGQccj5YFo7IG
|
| 12 |
-
TLOxI3DSNseuafzVnmVmU4Wo7gVdnsKcSlP9hZSBlmV70BGsLmyGmu5r9cQhWJq3
|
| 13 |
-
Ce1/LyEI6qAx74GvGX1G3VIB7nrfAgMBAAGjWTBXMA4GA1UdDwEB/wQEAwICpDAP
|
| 14 |
-
BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTQA7DAIo8ti8JuvwZD2Z2n53xQRzAV
|
| 15 |
-
BgNVHREEDjAMggprdWJlcm5ldGVzMA0GCSqGSIb3DQEBCwUAA4IBAQCxUrhLUzvk
|
| 16 |
-
CMeO295/IESvdLCHXhfVZDQO3xZQtrFAjlOl6MBuhN+6aucRBbu/RY9vo81nG7Ra
|
| 17 |
-
8rixgCh2NkQfggMloKWGXzlD9XGBokmf41tF+zr3RbBQaBmyKCv/CSt/Q6j0dibN
|
| 18 |
-
+2T6za09YoYY2unAnuP6fdJvbdAPPU9h6DchFGvzG7WtUbZEa+ueQ1O6VOfgVHLX
|
| 19 |
-
dL1Mva85Q02flEr2mj2YxYfODgOvN/SEccb7nKR7rhbGItupb8T88y8MZjPFvnp5
|
| 20 |
-
3yG4gmIDnJDx+mcM978zEyyzDwniGL5GHCZMhBOP6ZLbv3j8klVXJbbFeFi4GD2g
|
| 21 |
-
Ck+42sANlYhq
|
| 22 |
-
-----END CERTIFICATE-----
|
| 23 |
-
kind: ConfigMap
|
| 24 |
-
metadata:
|
| 25 |
-
annotations:
|
| 26 |
-
kubernetes.io/description: Contains a CA bundle that can be used to verify the
|
| 27 |
-
kube-apiserver when using internal endpoints such as the internal service IP
|
| 28 |
-
or kubernetes.default.svc. No other usage is guaranteed across distributions
|
| 29 |
-
of Kubernetes clusters.
|
| 30 |
-
creationTimestamp: "2026-03-06T10:04:21Z"
|
| 31 |
-
name: kube-root-ca.crt
|
| 32 |
-
namespace: k8s-opa-static-cis-511
|
| 33 |
-
resourceVersion: "2997707"
|
| 34 |
-
uid: 0660e796-ad03-45d5-97bd-1501ea8b51bd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/deployments/test-deployment.yaml
DELETED
|
@@ -1,67 +0,0 @@
|
|
| 1 |
-
apiVersion: apps/v1
|
| 2 |
-
kind: Deployment
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
deployment.kubernetes.io/revision: "1"
|
| 6 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 7 |
-
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"test-deployment","namespace":"k8s-opa-static-cis-511"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"test"}},"template":{"metadata":{"labels":{"app":"test"}},"spec":{"containers":[{"image":"nginx:1.14.2","name":"nginx","ports":[{"containerPort":80}]}],"serviceAccountName":"test-sa-violation"}}}}
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 9 |
-
generation: 1
|
| 10 |
-
name: test-deployment
|
| 11 |
-
namespace: k8s-opa-static-cis-511
|
| 12 |
-
resourceVersion: "3004985"
|
| 13 |
-
uid: e7156952-e611-4230-8334-04fc90232e65
|
| 14 |
-
spec:
|
| 15 |
-
progressDeadlineSeconds: 600
|
| 16 |
-
replicas: 1
|
| 17 |
-
revisionHistoryLimit: 10
|
| 18 |
-
selector:
|
| 19 |
-
matchLabels:
|
| 20 |
-
app: test
|
| 21 |
-
strategy:
|
| 22 |
-
rollingUpdate:
|
| 23 |
-
maxSurge: 25%
|
| 24 |
-
maxUnavailable: 25%
|
| 25 |
-
type: RollingUpdate
|
| 26 |
-
template:
|
| 27 |
-
metadata:
|
| 28 |
-
creationTimestamp: null
|
| 29 |
-
labels:
|
| 30 |
-
app: test
|
| 31 |
-
spec:
|
| 32 |
-
containers:
|
| 33 |
-
- image: nginx:1.14.2
|
| 34 |
-
imagePullPolicy: IfNotPresent
|
| 35 |
-
name: nginx
|
| 36 |
-
ports:
|
| 37 |
-
- containerPort: 80
|
| 38 |
-
protocol: TCP
|
| 39 |
-
resources: {}
|
| 40 |
-
terminationMessagePath: /dev/termination-log
|
| 41 |
-
terminationMessagePolicy: File
|
| 42 |
-
dnsPolicy: ClusterFirst
|
| 43 |
-
restartPolicy: Always
|
| 44 |
-
schedulerName: default-scheduler
|
| 45 |
-
securityContext: {}
|
| 46 |
-
serviceAccount: test-sa-violation
|
| 47 |
-
serviceAccountName: test-sa-violation
|
| 48 |
-
terminationGracePeriodSeconds: 30
|
| 49 |
-
status:
|
| 50 |
-
availableReplicas: 1
|
| 51 |
-
conditions:
|
| 52 |
-
- lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 53 |
-
lastUpdateTime: "2026-03-06T10:39:40Z"
|
| 54 |
-
message: Deployment has minimum availability.
|
| 55 |
-
reason: MinimumReplicasAvailable
|
| 56 |
-
status: "True"
|
| 57 |
-
type: Available
|
| 58 |
-
- lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 59 |
-
lastUpdateTime: "2026-03-06T10:39:40Z"
|
| 60 |
-
message: ReplicaSet "test-deployment-8d799b458" has successfully progressed.
|
| 61 |
-
reason: NewReplicaSetAvailable
|
| 62 |
-
status: "True"
|
| 63 |
-
type: Progressing
|
| 64 |
-
observedGeneration: 1
|
| 65 |
-
readyReplicas: 1
|
| 66 |
-
replicas: 1
|
| 67 |
-
updatedReplicas: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/pods/test-deployment-8d799b458-pvbmp.yaml
DELETED
|
@@ -1,121 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: Pod
|
| 3 |
-
metadata:
|
| 4 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 5 |
-
generateName: test-deployment-8d799b458-
|
| 6 |
-
labels:
|
| 7 |
-
app: test
|
| 8 |
-
pod-template-hash: 8d799b458
|
| 9 |
-
name: test-deployment-8d799b458-pvbmp
|
| 10 |
-
namespace: k8s-opa-static-cis-511
|
| 11 |
-
ownerReferences:
|
| 12 |
-
- apiVersion: apps/v1
|
| 13 |
-
blockOwnerDeletion: true
|
| 14 |
-
controller: true
|
| 15 |
-
kind: ReplicaSet
|
| 16 |
-
name: test-deployment-8d799b458
|
| 17 |
-
uid: 6b95f96c-dddc-44e8-bd5c-9faee0518482
|
| 18 |
-
resourceVersion: "3004981"
|
| 19 |
-
uid: 88f11ec0-d90a-422b-b9a4-60e4cc4b1f0f
|
| 20 |
-
spec:
|
| 21 |
-
containers:
|
| 22 |
-
- image: nginx:1.14.2
|
| 23 |
-
imagePullPolicy: IfNotPresent
|
| 24 |
-
name: nginx
|
| 25 |
-
ports:
|
| 26 |
-
- containerPort: 80
|
| 27 |
-
protocol: TCP
|
| 28 |
-
resources: {}
|
| 29 |
-
terminationMessagePath: /dev/termination-log
|
| 30 |
-
terminationMessagePolicy: File
|
| 31 |
-
volumeMounts:
|
| 32 |
-
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
| 33 |
-
name: kube-api-access-l467j
|
| 34 |
-
readOnly: true
|
| 35 |
-
dnsPolicy: ClusterFirst
|
| 36 |
-
enableServiceLinks: true
|
| 37 |
-
nodeName: kind-1-control-plane
|
| 38 |
-
preemptionPolicy: PreemptLowerPriority
|
| 39 |
-
priority: 0
|
| 40 |
-
restartPolicy: Always
|
| 41 |
-
schedulerName: default-scheduler
|
| 42 |
-
securityContext: {}
|
| 43 |
-
serviceAccount: test-sa-violation
|
| 44 |
-
serviceAccountName: test-sa-violation
|
| 45 |
-
terminationGracePeriodSeconds: 30
|
| 46 |
-
tolerations:
|
| 47 |
-
- effect: NoExecute
|
| 48 |
-
key: node.kubernetes.io/not-ready
|
| 49 |
-
operator: Exists
|
| 50 |
-
tolerationSeconds: 300
|
| 51 |
-
- effect: NoExecute
|
| 52 |
-
key: node.kubernetes.io/unreachable
|
| 53 |
-
operator: Exists
|
| 54 |
-
tolerationSeconds: 300
|
| 55 |
-
volumes:
|
| 56 |
-
- name: kube-api-access-l467j
|
| 57 |
-
projected:
|
| 58 |
-
defaultMode: 420
|
| 59 |
-
sources:
|
| 60 |
-
- serviceAccountToken:
|
| 61 |
-
expirationSeconds: 3607
|
| 62 |
-
path: token
|
| 63 |
-
- configMap:
|
| 64 |
-
items:
|
| 65 |
-
- key: ca.crt
|
| 66 |
-
path: ca.crt
|
| 67 |
-
name: kube-root-ca.crt
|
| 68 |
-
- downwardAPI:
|
| 69 |
-
items:
|
| 70 |
-
- fieldRef:
|
| 71 |
-
apiVersion: v1
|
| 72 |
-
fieldPath: metadata.namespace
|
| 73 |
-
path: namespace
|
| 74 |
-
status:
|
| 75 |
-
conditions:
|
| 76 |
-
- lastProbeTime: null
|
| 77 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 78 |
-
status: "True"
|
| 79 |
-
type: PodReadyToStartContainers
|
| 80 |
-
- lastProbeTime: null
|
| 81 |
-
lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 82 |
-
status: "True"
|
| 83 |
-
type: Initialized
|
| 84 |
-
- lastProbeTime: null
|
| 85 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 86 |
-
status: "True"
|
| 87 |
-
type: Ready
|
| 88 |
-
- lastProbeTime: null
|
| 89 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 90 |
-
status: "True"
|
| 91 |
-
type: ContainersReady
|
| 92 |
-
- lastProbeTime: null
|
| 93 |
-
lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 94 |
-
status: "True"
|
| 95 |
-
type: PodScheduled
|
| 96 |
-
containerStatuses:
|
| 97 |
-
- containerID: containerd://5e7c0e16527a5fc3096d786d41348b70ea8f4bafda1b7884fc09db096c9104dc
|
| 98 |
-
image: docker.io/library/nginx:1.14.2
|
| 99 |
-
imageID: docker.io/library/nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
|
| 100 |
-
lastState: {}
|
| 101 |
-
name: nginx
|
| 102 |
-
ready: true
|
| 103 |
-
restartCount: 0
|
| 104 |
-
started: true
|
| 105 |
-
state:
|
| 106 |
-
running:
|
| 107 |
-
startedAt: "2026-03-06T10:39:39Z"
|
| 108 |
-
volumeMounts:
|
| 109 |
-
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
| 110 |
-
name: kube-api-access-l467j
|
| 111 |
-
readOnly: true
|
| 112 |
-
recursiveReadOnly: Disabled
|
| 113 |
-
hostIP: 172.18.0.2
|
| 114 |
-
hostIPs:
|
| 115 |
-
- ip: 172.18.0.2
|
| 116 |
-
phase: Running
|
| 117 |
-
podIP: 10.244.0.151
|
| 118 |
-
podIPs:
|
| 119 |
-
- ip: 10.244.0.151
|
| 120 |
-
qosClass: BestEffort
|
| 121 |
-
startTime: "2026-03-06T10:39:36Z"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/replicasets/test-deployment-8d799b458.yaml
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
apiVersion: apps/v1
|
| 2 |
-
kind: ReplicaSet
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
deployment.kubernetes.io/desired-replicas: "1"
|
| 6 |
-
deployment.kubernetes.io/max-replicas: "2"
|
| 7 |
-
deployment.kubernetes.io/revision: "1"
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 9 |
-
generation: 1
|
| 10 |
-
labels:
|
| 11 |
-
app: test
|
| 12 |
-
pod-template-hash: 8d799b458
|
| 13 |
-
name: test-deployment-8d799b458
|
| 14 |
-
namespace: k8s-opa-static-cis-511
|
| 15 |
-
ownerReferences:
|
| 16 |
-
- apiVersion: apps/v1
|
| 17 |
-
blockOwnerDeletion: true
|
| 18 |
-
controller: true
|
| 19 |
-
kind: Deployment
|
| 20 |
-
name: test-deployment
|
| 21 |
-
uid: e7156952-e611-4230-8334-04fc90232e65
|
| 22 |
-
resourceVersion: "3004984"
|
| 23 |
-
uid: 6b95f96c-dddc-44e8-bd5c-9faee0518482
|
| 24 |
-
spec:
|
| 25 |
-
replicas: 1
|
| 26 |
-
selector:
|
| 27 |
-
matchLabels:
|
| 28 |
-
app: test
|
| 29 |
-
pod-template-hash: 8d799b458
|
| 30 |
-
template:
|
| 31 |
-
metadata:
|
| 32 |
-
creationTimestamp: null
|
| 33 |
-
labels:
|
| 34 |
-
app: test
|
| 35 |
-
pod-template-hash: 8d799b458
|
| 36 |
-
spec:
|
| 37 |
-
containers:
|
| 38 |
-
- image: nginx:1.14.2
|
| 39 |
-
imagePullPolicy: IfNotPresent
|
| 40 |
-
name: nginx
|
| 41 |
-
ports:
|
| 42 |
-
- containerPort: 80
|
| 43 |
-
protocol: TCP
|
| 44 |
-
resources: {}
|
| 45 |
-
terminationMessagePath: /dev/termination-log
|
| 46 |
-
terminationMessagePolicy: File
|
| 47 |
-
dnsPolicy: ClusterFirst
|
| 48 |
-
restartPolicy: Always
|
| 49 |
-
schedulerName: default-scheduler
|
| 50 |
-
securityContext: {}
|
| 51 |
-
serviceAccount: test-sa-violation
|
| 52 |
-
serviceAccountName: test-sa-violation
|
| 53 |
-
terminationGracePeriodSeconds: 30
|
| 54 |
-
status:
|
| 55 |
-
availableReplicas: 1
|
| 56 |
-
fullyLabeledReplicas: 1
|
| 57 |
-
observedGeneration: 1
|
| 58 |
-
readyReplicas: 1
|
| 59 |
-
replicas: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/benchmark-admin-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"benchmark-admin-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"benchmark-admin-role"},"subjects":[{"kind":"ServiceAccount","name":"benchmark-admin-sa","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:34Z"
|
| 8 |
-
name: benchmark-admin-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004940"
|
| 11 |
-
uid: a3798d24-cce4-4bc9-8982-731a8fa1b790
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: benchmark-admin-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: benchmark-admin-sa
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/benchmark-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"benchmark-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"wildcard-role"},"subjects":[{"kind":"ServiceAccount","name":"benchmark-sa","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:28Z"
|
| 8 |
-
name: benchmark-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997732"
|
| 11 |
-
uid: 3498f326-7bcd-4a66-ab1f-24e52d09fb15
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: wildcard-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: benchmark-sa
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/rolebindings/compliant-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"compliant-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"limited-role"},"subjects":[{"kind":"ServiceAccount","name":"test-sa-compliant","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:35Z"
|
| 8 |
-
name: compliant-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004944"
|
| 11 |
-
uid: 923431de-c28e-4f6f-9c56-034e835133bc
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: limited-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: test-sa-compliant
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/benchmark-admin-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"benchmark-admin-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:32Z"
|
| 8 |
-
name: benchmark-admin-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004931"
|
| 11 |
-
uid: 2fde6bdc-1128-43c3-af22-3d3624eba656
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/cluster-admin-like-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"cluster-admin-like-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:32Z"
|
| 8 |
-
name: cluster-admin-like-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004927"
|
| 11 |
-
uid: 005d5031-42ad-4112-8eda-ea71632ea38a
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/limited-role.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"limited-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":[""],"resources":["pods"],"verbs":["get","list"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:33Z"
|
| 8 |
-
name: limited-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004935"
|
| 11 |
-
uid: 2b1bb058-ba29-4874-b30f-e539fc303477
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- ""
|
| 15 |
-
resources:
|
| 16 |
-
- pods
|
| 17 |
-
verbs:
|
| 18 |
-
- get
|
| 19 |
-
- list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/roles/wildcard-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"wildcard-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:26Z"
|
| 8 |
-
name: wildcard-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997724"
|
| 11 |
-
uid: 3a280021-0099-43f0-83ab-ed7288aa14cf
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/benchmark-admin-sa.yaml
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
description: Benchmark system service account - should be excluded from checks
|
| 6 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 7 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{"description":"Benchmark system service account - should be excluded from checks"},"name":"benchmark-admin-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:31Z"
|
| 9 |
-
name: benchmark-admin-sa
|
| 10 |
-
namespace: k8s-opa-static-cis-511
|
| 11 |
-
resourceVersion: "3004925"
|
| 12 |
-
uid: 57cfb9cf-e7c6-4150-819c-fa7919564a52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/benchmark-sa.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"benchmark-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:23Z"
|
| 8 |
-
name: benchmark-sa
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997710"
|
| 11 |
-
uid: 1d566c0c-2cbd-4e91-bd20-cb1a79d86dfc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/default.yaml
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
creationTimestamp: "2026-03-06T10:04:21Z"
|
| 5 |
-
name: default
|
| 6 |
-
namespace: k8s-opa-static-cis-511
|
| 7 |
-
resourceVersion: "2997706"
|
| 8 |
-
uid: 34e63ab9-3aea-4684-9bce-46a6051053b8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/test-sa-compliant.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"test-sa-compliant","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:30Z"
|
| 8 |
-
name: test-sa-compliant
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004921"
|
| 11 |
-
uid: 49418e80-ad61-49b9-98c6-0e1572bfa59e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/test-sa-violation.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"test-sa-violation","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:30Z"
|
| 8 |
-
name: test-sa-violation
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004918"
|
| 11 |
-
uid: 0291260d-03c5-4259-b8e8-eb2911f89438
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/serviceaccounts/violating-sa.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"violating-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:25Z"
|
| 8 |
-
name: violating-sa
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997716"
|
| 11 |
-
uid: aa8d64b8-b961-44a4-b1e9-d8da0d04f3f6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources-compliant/services/test-service.yaml
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: Service
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"test-service","namespace":"k8s-opa-static-cis-511"},"spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":80}],"selector":{"app":"test"}}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 8 |
-
name: test-service
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004963"
|
| 11 |
-
uid: 4021ba47-f3d2-439d-a341-0efa61c1dffb
|
| 12 |
-
spec:
|
| 13 |
-
clusterIP: 10.96.84.93
|
| 14 |
-
clusterIPs:
|
| 15 |
-
- 10.96.84.93
|
| 16 |
-
internalTrafficPolicy: Cluster
|
| 17 |
-
ipFamilies:
|
| 18 |
-
- IPv4
|
| 19 |
-
ipFamilyPolicy: SingleStack
|
| 20 |
-
ports:
|
| 21 |
-
- port: 80
|
| 22 |
-
protocol: TCP
|
| 23 |
-
targetPort: 80
|
| 24 |
-
selector:
|
| 25 |
-
app: test
|
| 26 |
-
sessionAffinity: None
|
| 27 |
-
type: ClusterIP
|
| 28 |
-
status:
|
| 29 |
-
loadBalancer: {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/configmaps/kube-root-ca.crt.yaml
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
data:
|
| 3 |
-
ca.crt: |
|
| 4 |
-
-----BEGIN CERTIFICATE-----
|
| 5 |
-
MIIDBTCCAe2gAwIBAgIIUAOla/7ups4wDQYJKoZIhvcNAQELBQAwFTETMBEGA1UE
|
| 6 |
-
AxMKa3ViZXJuZXRlczAeFw0yNjAyMjQwNTQzMTVaFw0zNjAyMjIwNTQ4MTVaMBUx
|
| 7 |
-
EzARBgNVBAMTCmt1YmVybmV0ZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
| 8 |
-
AoIBAQDQZNy0hQ3zl5/RVSHLpdu6fvGiGqQPGHujHphY3B7kcKmE6G7gSWQfIWzp
|
| 9 |
-
HsFQ2vXRGHfhS5rJDAwPAiEEIoWz7FN+ibpvjyj91NNidHP4LrDVZyhJHFxjB2Lw
|
| 10 |
-
xy1Mw6ok5ZONsHZ7KcW6pKonSM176tzktiirNbFFcaTc02xFyWEbuyrXbSm9NraX
|
| 11 |
-
dw5q9bfPjJXAyy9o3Ymh5TGpFmU/OpLpcpiZqQ6uPNHaU63T8qevGQccj5YFo7IG
|
| 12 |
-
TLOxI3DSNseuafzVnmVmU4Wo7gVdnsKcSlP9hZSBlmV70BGsLmyGmu5r9cQhWJq3
|
| 13 |
-
Ce1/LyEI6qAx74GvGX1G3VIB7nrfAgMBAAGjWTBXMA4GA1UdDwEB/wQEAwICpDAP
|
| 14 |
-
BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTQA7DAIo8ti8JuvwZD2Z2n53xQRzAV
|
| 15 |
-
BgNVHREEDjAMggprdWJlcm5ldGVzMA0GCSqGSIb3DQEBCwUAA4IBAQCxUrhLUzvk
|
| 16 |
-
CMeO295/IESvdLCHXhfVZDQO3xZQtrFAjlOl6MBuhN+6aucRBbu/RY9vo81nG7Ra
|
| 17 |
-
8rixgCh2NkQfggMloKWGXzlD9XGBokmf41tF+zr3RbBQaBmyKCv/CSt/Q6j0dibN
|
| 18 |
-
+2T6za09YoYY2unAnuP6fdJvbdAPPU9h6DchFGvzG7WtUbZEa+ueQ1O6VOfgVHLX
|
| 19 |
-
dL1Mva85Q02flEr2mj2YxYfODgOvN/SEccb7nKR7rhbGItupb8T88y8MZjPFvnp5
|
| 20 |
-
3yG4gmIDnJDx+mcM978zEyyzDwniGL5GHCZMhBOP6ZLbv3j8klVXJbbFeFi4GD2g
|
| 21 |
-
Ck+42sANlYhq
|
| 22 |
-
-----END CERTIFICATE-----
|
| 23 |
-
kind: ConfigMap
|
| 24 |
-
metadata:
|
| 25 |
-
annotations:
|
| 26 |
-
kubernetes.io/description: Contains a CA bundle that can be used to verify the
|
| 27 |
-
kube-apiserver when using internal endpoints such as the internal service IP
|
| 28 |
-
or kubernetes.default.svc. No other usage is guaranteed across distributions
|
| 29 |
-
of Kubernetes clusters.
|
| 30 |
-
creationTimestamp: "2026-03-06T10:04:21Z"
|
| 31 |
-
name: kube-root-ca.crt
|
| 32 |
-
namespace: k8s-opa-static-cis-511
|
| 33 |
-
resourceVersion: "2997707"
|
| 34 |
-
uid: 0660e796-ad03-45d5-97bd-1501ea8b51bd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/deployments/test-deployment.yaml
DELETED
|
@@ -1,67 +0,0 @@
|
|
| 1 |
-
apiVersion: apps/v1
|
| 2 |
-
kind: Deployment
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
deployment.kubernetes.io/revision: "1"
|
| 6 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 7 |
-
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"test-deployment","namespace":"k8s-opa-static-cis-511"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"test"}},"template":{"metadata":{"labels":{"app":"test"}},"spec":{"containers":[{"image":"nginx:1.14.2","name":"nginx","ports":[{"containerPort":80}]}],"serviceAccountName":"test-sa-violation"}}}}
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 9 |
-
generation: 1
|
| 10 |
-
name: test-deployment
|
| 11 |
-
namespace: k8s-opa-static-cis-511
|
| 12 |
-
resourceVersion: "3004985"
|
| 13 |
-
uid: e7156952-e611-4230-8334-04fc90232e65
|
| 14 |
-
spec:
|
| 15 |
-
progressDeadlineSeconds: 600
|
| 16 |
-
replicas: 1
|
| 17 |
-
revisionHistoryLimit: 10
|
| 18 |
-
selector:
|
| 19 |
-
matchLabels:
|
| 20 |
-
app: test
|
| 21 |
-
strategy:
|
| 22 |
-
rollingUpdate:
|
| 23 |
-
maxSurge: 25%
|
| 24 |
-
maxUnavailable: 25%
|
| 25 |
-
type: RollingUpdate
|
| 26 |
-
template:
|
| 27 |
-
metadata:
|
| 28 |
-
creationTimestamp: null
|
| 29 |
-
labels:
|
| 30 |
-
app: test
|
| 31 |
-
spec:
|
| 32 |
-
containers:
|
| 33 |
-
- image: nginx:1.14.2
|
| 34 |
-
imagePullPolicy: IfNotPresent
|
| 35 |
-
name: nginx
|
| 36 |
-
ports:
|
| 37 |
-
- containerPort: 80
|
| 38 |
-
protocol: TCP
|
| 39 |
-
resources: {}
|
| 40 |
-
terminationMessagePath: /dev/termination-log
|
| 41 |
-
terminationMessagePolicy: File
|
| 42 |
-
dnsPolicy: ClusterFirst
|
| 43 |
-
restartPolicy: Always
|
| 44 |
-
schedulerName: default-scheduler
|
| 45 |
-
securityContext: {}
|
| 46 |
-
serviceAccount: test-sa-violation
|
| 47 |
-
serviceAccountName: test-sa-violation
|
| 48 |
-
terminationGracePeriodSeconds: 30
|
| 49 |
-
status:
|
| 50 |
-
availableReplicas: 1
|
| 51 |
-
conditions:
|
| 52 |
-
- lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 53 |
-
lastUpdateTime: "2026-03-06T10:39:40Z"
|
| 54 |
-
message: Deployment has minimum availability.
|
| 55 |
-
reason: MinimumReplicasAvailable
|
| 56 |
-
status: "True"
|
| 57 |
-
type: Available
|
| 58 |
-
- lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 59 |
-
lastUpdateTime: "2026-03-06T10:39:40Z"
|
| 60 |
-
message: ReplicaSet "test-deployment-8d799b458" has successfully progressed.
|
| 61 |
-
reason: NewReplicaSetAvailable
|
| 62 |
-
status: "True"
|
| 63 |
-
type: Progressing
|
| 64 |
-
observedGeneration: 1
|
| 65 |
-
readyReplicas: 1
|
| 66 |
-
replicas: 1
|
| 67 |
-
updatedReplicas: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/pods/test-deployment-8d799b458-pvbmp.yaml
DELETED
|
@@ -1,121 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: Pod
|
| 3 |
-
metadata:
|
| 4 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 5 |
-
generateName: test-deployment-8d799b458-
|
| 6 |
-
labels:
|
| 7 |
-
app: test
|
| 8 |
-
pod-template-hash: 8d799b458
|
| 9 |
-
name: test-deployment-8d799b458-pvbmp
|
| 10 |
-
namespace: k8s-opa-static-cis-511
|
| 11 |
-
ownerReferences:
|
| 12 |
-
- apiVersion: apps/v1
|
| 13 |
-
blockOwnerDeletion: true
|
| 14 |
-
controller: true
|
| 15 |
-
kind: ReplicaSet
|
| 16 |
-
name: test-deployment-8d799b458
|
| 17 |
-
uid: 6b95f96c-dddc-44e8-bd5c-9faee0518482
|
| 18 |
-
resourceVersion: "3004981"
|
| 19 |
-
uid: 88f11ec0-d90a-422b-b9a4-60e4cc4b1f0f
|
| 20 |
-
spec:
|
| 21 |
-
containers:
|
| 22 |
-
- image: nginx:1.14.2
|
| 23 |
-
imagePullPolicy: IfNotPresent
|
| 24 |
-
name: nginx
|
| 25 |
-
ports:
|
| 26 |
-
- containerPort: 80
|
| 27 |
-
protocol: TCP
|
| 28 |
-
resources: {}
|
| 29 |
-
terminationMessagePath: /dev/termination-log
|
| 30 |
-
terminationMessagePolicy: File
|
| 31 |
-
volumeMounts:
|
| 32 |
-
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
| 33 |
-
name: kube-api-access-l467j
|
| 34 |
-
readOnly: true
|
| 35 |
-
dnsPolicy: ClusterFirst
|
| 36 |
-
enableServiceLinks: true
|
| 37 |
-
nodeName: kind-1-control-plane
|
| 38 |
-
preemptionPolicy: PreemptLowerPriority
|
| 39 |
-
priority: 0
|
| 40 |
-
restartPolicy: Always
|
| 41 |
-
schedulerName: default-scheduler
|
| 42 |
-
securityContext: {}
|
| 43 |
-
serviceAccount: test-sa-violation
|
| 44 |
-
serviceAccountName: test-sa-violation
|
| 45 |
-
terminationGracePeriodSeconds: 30
|
| 46 |
-
tolerations:
|
| 47 |
-
- effect: NoExecute
|
| 48 |
-
key: node.kubernetes.io/not-ready
|
| 49 |
-
operator: Exists
|
| 50 |
-
tolerationSeconds: 300
|
| 51 |
-
- effect: NoExecute
|
| 52 |
-
key: node.kubernetes.io/unreachable
|
| 53 |
-
operator: Exists
|
| 54 |
-
tolerationSeconds: 300
|
| 55 |
-
volumes:
|
| 56 |
-
- name: kube-api-access-l467j
|
| 57 |
-
projected:
|
| 58 |
-
defaultMode: 420
|
| 59 |
-
sources:
|
| 60 |
-
- serviceAccountToken:
|
| 61 |
-
expirationSeconds: 3607
|
| 62 |
-
path: token
|
| 63 |
-
- configMap:
|
| 64 |
-
items:
|
| 65 |
-
- key: ca.crt
|
| 66 |
-
path: ca.crt
|
| 67 |
-
name: kube-root-ca.crt
|
| 68 |
-
- downwardAPI:
|
| 69 |
-
items:
|
| 70 |
-
- fieldRef:
|
| 71 |
-
apiVersion: v1
|
| 72 |
-
fieldPath: metadata.namespace
|
| 73 |
-
path: namespace
|
| 74 |
-
status:
|
| 75 |
-
conditions:
|
| 76 |
-
- lastProbeTime: null
|
| 77 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 78 |
-
status: "True"
|
| 79 |
-
type: PodReadyToStartContainers
|
| 80 |
-
- lastProbeTime: null
|
| 81 |
-
lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 82 |
-
status: "True"
|
| 83 |
-
type: Initialized
|
| 84 |
-
- lastProbeTime: null
|
| 85 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 86 |
-
status: "True"
|
| 87 |
-
type: Ready
|
| 88 |
-
- lastProbeTime: null
|
| 89 |
-
lastTransitionTime: "2026-03-06T10:39:40Z"
|
| 90 |
-
status: "True"
|
| 91 |
-
type: ContainersReady
|
| 92 |
-
- lastProbeTime: null
|
| 93 |
-
lastTransitionTime: "2026-03-06T10:39:36Z"
|
| 94 |
-
status: "True"
|
| 95 |
-
type: PodScheduled
|
| 96 |
-
containerStatuses:
|
| 97 |
-
- containerID: containerd://5e7c0e16527a5fc3096d786d41348b70ea8f4bafda1b7884fc09db096c9104dc
|
| 98 |
-
image: docker.io/library/nginx:1.14.2
|
| 99 |
-
imageID: docker.io/library/nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
|
| 100 |
-
lastState: {}
|
| 101 |
-
name: nginx
|
| 102 |
-
ready: true
|
| 103 |
-
restartCount: 0
|
| 104 |
-
started: true
|
| 105 |
-
state:
|
| 106 |
-
running:
|
| 107 |
-
startedAt: "2026-03-06T10:39:39Z"
|
| 108 |
-
volumeMounts:
|
| 109 |
-
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
| 110 |
-
name: kube-api-access-l467j
|
| 111 |
-
readOnly: true
|
| 112 |
-
recursiveReadOnly: Disabled
|
| 113 |
-
hostIP: 172.18.0.2
|
| 114 |
-
hostIPs:
|
| 115 |
-
- ip: 172.18.0.2
|
| 116 |
-
phase: Running
|
| 117 |
-
podIP: 10.244.0.151
|
| 118 |
-
podIPs:
|
| 119 |
-
- ip: 10.244.0.151
|
| 120 |
-
qosClass: BestEffort
|
| 121 |
-
startTime: "2026-03-06T10:39:36Z"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/replicasets/test-deployment-8d799b458.yaml
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
apiVersion: apps/v1
|
| 2 |
-
kind: ReplicaSet
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
deployment.kubernetes.io/desired-replicas: "1"
|
| 6 |
-
deployment.kubernetes.io/max-replicas: "2"
|
| 7 |
-
deployment.kubernetes.io/revision: "1"
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 9 |
-
generation: 1
|
| 10 |
-
labels:
|
| 11 |
-
app: test
|
| 12 |
-
pod-template-hash: 8d799b458
|
| 13 |
-
name: test-deployment-8d799b458
|
| 14 |
-
namespace: k8s-opa-static-cis-511
|
| 15 |
-
ownerReferences:
|
| 16 |
-
- apiVersion: apps/v1
|
| 17 |
-
blockOwnerDeletion: true
|
| 18 |
-
controller: true
|
| 19 |
-
kind: Deployment
|
| 20 |
-
name: test-deployment
|
| 21 |
-
uid: e7156952-e611-4230-8334-04fc90232e65
|
| 22 |
-
resourceVersion: "3004984"
|
| 23 |
-
uid: 6b95f96c-dddc-44e8-bd5c-9faee0518482
|
| 24 |
-
spec:
|
| 25 |
-
replicas: 1
|
| 26 |
-
selector:
|
| 27 |
-
matchLabels:
|
| 28 |
-
app: test
|
| 29 |
-
pod-template-hash: 8d799b458
|
| 30 |
-
template:
|
| 31 |
-
metadata:
|
| 32 |
-
creationTimestamp: null
|
| 33 |
-
labels:
|
| 34 |
-
app: test
|
| 35 |
-
pod-template-hash: 8d799b458
|
| 36 |
-
spec:
|
| 37 |
-
containers:
|
| 38 |
-
- image: nginx:1.14.2
|
| 39 |
-
imagePullPolicy: IfNotPresent
|
| 40 |
-
name: nginx
|
| 41 |
-
ports:
|
| 42 |
-
- containerPort: 80
|
| 43 |
-
protocol: TCP
|
| 44 |
-
resources: {}
|
| 45 |
-
terminationMessagePath: /dev/termination-log
|
| 46 |
-
terminationMessagePolicy: File
|
| 47 |
-
dnsPolicy: ClusterFirst
|
| 48 |
-
restartPolicy: Always
|
| 49 |
-
schedulerName: default-scheduler
|
| 50 |
-
securityContext: {}
|
| 51 |
-
serviceAccount: test-sa-violation
|
| 52 |
-
serviceAccountName: test-sa-violation
|
| 53 |
-
terminationGracePeriodSeconds: 30
|
| 54 |
-
status:
|
| 55 |
-
availableReplicas: 1
|
| 56 |
-
fullyLabeledReplicas: 1
|
| 57 |
-
observedGeneration: 1
|
| 58 |
-
readyReplicas: 1
|
| 59 |
-
replicas: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/benchmark-admin-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"benchmark-admin-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"benchmark-admin-role"},"subjects":[{"kind":"ServiceAccount","name":"benchmark-admin-sa","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:34Z"
|
| 8 |
-
name: benchmark-admin-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004940"
|
| 11 |
-
uid: a3798d24-cce4-4bc9-8982-731a8fa1b790
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: benchmark-admin-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: benchmark-admin-sa
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/benchmark-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"benchmark-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"wildcard-role"},"subjects":[{"kind":"ServiceAccount","name":"benchmark-sa","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:28Z"
|
| 8 |
-
name: benchmark-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997732"
|
| 11 |
-
uid: 3498f326-7bcd-4a66-ab1f-24e52d09fb15
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: wildcard-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: benchmark-sa
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/compliant-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"compliant-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"limited-role"},"subjects":[{"kind":"ServiceAccount","name":"test-sa-compliant","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:35Z"
|
| 8 |
-
name: compliant-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004944"
|
| 11 |
-
uid: 923431de-c28e-4f6f-9c56-034e835133bc
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: limited-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: test-sa-compliant
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/violating-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"violating-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"ClusterRole","name":"cluster-admin"},"subjects":[{"kind":"ServiceAccount","name":"violating-sa","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:30Z"
|
| 8 |
-
name: violating-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997740"
|
| 11 |
-
uid: 69ff635b-a18a-441a-bb5d-b04d8657ce82
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: ClusterRole
|
| 15 |
-
name: cluster-admin
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: violating-sa
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/rolebindings/violation-binding.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: RoleBinding
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"RoleBinding","metadata":{"annotations":{},"name":"violation-binding","namespace":"k8s-opa-static-cis-511"},"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role","name":"cluster-admin-like-role"},"subjects":[{"kind":"ServiceAccount","name":"test-sa-violation","namespace":"k8s-opa-static-cis-511"}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:34Z"
|
| 8 |
-
name: violation-binding
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004937"
|
| 11 |
-
uid: 0c443714-9b7d-4fc5-bffc-bd535b48b328
|
| 12 |
-
roleRef:
|
| 13 |
-
apiGroup: rbac.authorization.k8s.io
|
| 14 |
-
kind: Role
|
| 15 |
-
name: cluster-admin-like-role
|
| 16 |
-
subjects:
|
| 17 |
-
- kind: ServiceAccount
|
| 18 |
-
name: test-sa-violation
|
| 19 |
-
namespace: k8s-opa-static-cis-511
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/benchmark-admin-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"benchmark-admin-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:32Z"
|
| 8 |
-
name: benchmark-admin-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004931"
|
| 11 |
-
uid: 2fde6bdc-1128-43c3-af22-3d3624eba656
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/cluster-admin-like-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"cluster-admin-like-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:32Z"
|
| 8 |
-
name: cluster-admin-like-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004927"
|
| 11 |
-
uid: 005d5031-42ad-4112-8eda-ea71632ea38a
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/limited-role.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"limited-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":[""],"resources":["pods"],"verbs":["get","list"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:33Z"
|
| 8 |
-
name: limited-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004935"
|
| 11 |
-
uid: 2b1bb058-ba29-4874-b30f-e539fc303477
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- ""
|
| 15 |
-
resources:
|
| 16 |
-
- pods
|
| 17 |
-
verbs:
|
| 18 |
-
- get
|
| 19 |
-
- list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/roles/wildcard-role.yaml
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
apiVersion: rbac.authorization.k8s.io/v1
|
| 2 |
-
kind: Role
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"rbac.authorization.k8s.io/v1","kind":"Role","metadata":{"annotations":{},"name":"wildcard-role","namespace":"k8s-opa-static-cis-511"},"rules":[{"apiGroups":["*"],"resources":["*"],"verbs":["*"]}]}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:26Z"
|
| 8 |
-
name: wildcard-role
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997724"
|
| 11 |
-
uid: 3a280021-0099-43f0-83ab-ed7288aa14cf
|
| 12 |
-
rules:
|
| 13 |
-
- apiGroups:
|
| 14 |
-
- '*'
|
| 15 |
-
resources:
|
| 16 |
-
- '*'
|
| 17 |
-
verbs:
|
| 18 |
-
- '*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/benchmark-admin-sa.yaml
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
description: Benchmark system service account - should be excluded from checks
|
| 6 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 7 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{"description":"Benchmark system service account - should be excluded from checks"},"name":"benchmark-admin-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 8 |
-
creationTimestamp: "2026-03-06T10:39:31Z"
|
| 9 |
-
name: benchmark-admin-sa
|
| 10 |
-
namespace: k8s-opa-static-cis-511
|
| 11 |
-
resourceVersion: "3004925"
|
| 12 |
-
uid: 57cfb9cf-e7c6-4150-819c-fa7919564a52
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/benchmark-sa.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"benchmark-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:23Z"
|
| 8 |
-
name: benchmark-sa
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997710"
|
| 11 |
-
uid: 1d566c0c-2cbd-4e91-bd20-cb1a79d86dfc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/default.yaml
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
creationTimestamp: "2026-03-06T10:04:21Z"
|
| 5 |
-
name: default
|
| 6 |
-
namespace: k8s-opa-static-cis-511
|
| 7 |
-
resourceVersion: "2997706"
|
| 8 |
-
uid: 34e63ab9-3aea-4684-9bce-46a6051053b8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/test-sa-compliant.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"test-sa-compliant","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:30Z"
|
| 8 |
-
name: test-sa-compliant
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004921"
|
| 11 |
-
uid: 49418e80-ad61-49b9-98c6-0e1572bfa59e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/test-sa-violation.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"test-sa-violation","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:30Z"
|
| 8 |
-
name: test-sa-violation
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004918"
|
| 11 |
-
uid: 0291260d-03c5-4259-b8e8-eb2911f89438
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/serviceaccounts/violating-sa.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: ServiceAccount
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{},"name":"violating-sa","namespace":"k8s-opa-static-cis-511"}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:04:25Z"
|
| 8 |
-
name: violating-sa
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "2997716"
|
| 11 |
-
uid: aa8d64b8-b961-44a4-b1e9-d8da0d04f3f6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.1/static-resources/services/test-service.yaml
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
kind: Service
|
| 3 |
-
metadata:
|
| 4 |
-
annotations:
|
| 5 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 6 |
-
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"test-service","namespace":"k8s-opa-static-cis-511"},"spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":80}],"selector":{"app":"test"}}}
|
| 7 |
-
creationTimestamp: "2026-03-06T10:39:36Z"
|
| 8 |
-
name: test-service
|
| 9 |
-
namespace: k8s-opa-static-cis-511
|
| 10 |
-
resourceVersion: "3004963"
|
| 11 |
-
uid: 4021ba47-f3d2-439d-a341-0efa61c1dffb
|
| 12 |
-
spec:
|
| 13 |
-
clusterIP: 10.96.84.93
|
| 14 |
-
clusterIPs:
|
| 15 |
-
- 10.96.84.93
|
| 16 |
-
internalTrafficPolicy: Cluster
|
| 17 |
-
ipFamilies:
|
| 18 |
-
- IPv4
|
| 19 |
-
ipFamilyPolicy: SingleStack
|
| 20 |
-
ports:
|
| 21 |
-
- port: 80
|
| 22 |
-
protocol: TCP
|
| 23 |
-
targetPort: 80
|
| 24 |
-
selector:
|
| 25 |
-
app: test
|
| 26 |
-
sessionAffinity: None
|
| 27 |
-
type: ClusterIP
|
| 28 |
-
status:
|
| 29 |
-
loadBalancer: {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/ground-truth/fetch.sh
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
# Initialize empty JSON structure
|
| 4 |
-
echo '{"roles": []}' > collected_data.json
|
| 5 |
-
|
| 6 |
-
# Process all role YAML files
|
| 7 |
-
if [ -d "./static-resources/roles" ]; then
|
| 8 |
-
temp_file=$(mktemp)
|
| 9 |
-
|
| 10 |
-
# Combine all roles into a single JSON array
|
| 11 |
-
{
|
| 12 |
-
echo '{"roles": ['
|
| 13 |
-
first=true
|
| 14 |
-
for role_file in ./static-resources/roles/*.yaml; do
|
| 15 |
-
if [ -f "$role_file" ]; then
|
| 16 |
-
if [ "$first" = true ]; then
|
| 17 |
-
first=false
|
| 18 |
-
else
|
| 19 |
-
echo ","
|
| 20 |
-
fi
|
| 21 |
-
# Convert YAML to JSON
|
| 22 |
-
python3 -c "
|
| 23 |
-
import yaml, json, sys
|
| 24 |
-
with open('$role_file', 'r') as f:
|
| 25 |
-
data = yaml.safe_load(f)
|
| 26 |
-
if data:
|
| 27 |
-
print(json.dumps(data), end='')
|
| 28 |
-
"
|
| 29 |
-
fi
|
| 30 |
-
done
|
| 31 |
-
echo ']}'
|
| 32 |
-
} > collected_data.json
|
| 33 |
-
fi
|
| 34 |
-
|
| 35 |
-
# Ensure the file exists even if no roles found
|
| 36 |
-
if [ ! -f collected_data.json ]; then
|
| 37 |
-
echo '{"roles": []}' > collected_data.json
|
| 38 |
-
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/ground-truth/policy.rego
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
package check
|
| 2 |
-
|
| 3 |
-
import rego.v1
|
| 4 |
-
|
| 5 |
-
# Default result is true (compliant)
|
| 6 |
-
default result := true
|
| 7 |
-
|
| 8 |
-
# Result is false if any violations are found
|
| 9 |
-
result := false if {
|
| 10 |
-
count(violations) > 0
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
# Find all violations (roles with wildcards that are not benchmark-related)
|
| 14 |
-
violations contains role if {
|
| 15 |
-
some role in input.roles
|
| 16 |
-
has_wildcard_violation(role)
|
| 17 |
-
not is_benchmark_role(role)
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
# Check if role has wildcard violations
|
| 21 |
-
has_wildcard_violation(role) if {
|
| 22 |
-
some rule in role.rules
|
| 23 |
-
"*" in rule.resources
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
has_wildcard_violation(role) if {
|
| 27 |
-
some rule in role.rules
|
| 28 |
-
"*" in rule.verbs
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
has_wildcard_violation(role) if {
|
| 32 |
-
some rule in role.rules
|
| 33 |
-
"*" in rule.apiGroups
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
# Check if role is benchmark-related (should be excluded)
|
| 37 |
-
is_benchmark_role(role) if {
|
| 38 |
-
role.metadata.labels.app == "benchmark"
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
is_benchmark_role(role) if {
|
| 42 |
-
role.metadata.labels.component == "benchmark-service"
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
is_benchmark_role(role) if {
|
| 46 |
-
contains(role.metadata.name, "benchmark")
|
| 47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/problem.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
# Problem: CIS 5.1.3 - Role Wildcard Usage Detection
|
| 2 |
-
|
| 3 |
-
## Objective
|
| 4 |
-
|
| 5 |
-
Implement a compliance checking system to detect inappropriate wildcard usage in Kubernetes Roles according to CIS Benchmark 5.1.3. You need to create both a data fetcher and an OPA policy to identify violations.
|
| 6 |
-
|
| 7 |
-
## Requirements
|
| 8 |
-
|
| 9 |
-
### CIS 5.1.3 Compliance Rule
|
| 10 |
-
Minimize the use of wildcards in Roles. Specifically:
|
| 11 |
-
- Roles should not use wildcard (`"*"`) in `resources` field
|
| 12 |
-
- Roles should not use wildcard (`"*"`) in `verbs` field
|
| 13 |
-
- Roles should not use wildcard (`"*"`) in `apiGroups` field
|
| 14 |
-
|
| 15 |
-
### Exception Handling
|
| 16 |
-
- Benchmark-related service accounts may legitimately use wildcard permissions
|
| 17 |
-
- These should be excluded from violation detection
|
| 18 |
-
- Look for roles associated with benchmark operations (may have labels like `app: benchmark`)
|
| 19 |
-
|
| 20 |
-
### Implementation Requirements
|
| 21 |
-
|
| 22 |
-
You must create two files in the current directory:
|
| 23 |
-
|
| 24 |
-
1. **fetch.sh** - Data collection script
|
| 25 |
-
- Extract Role definitions from the provided static resources
|
| 26 |
-
- Output collected data to `collected_data.json` file
|
| 27 |
-
- Process YAML files in the static resources directory
|
| 28 |
-
|
| 29 |
-
2. **policy.rego** - OPA policy for violation detection
|
| 30 |
-
- Package name must be: `package check`
|
| 31 |
-
- Must define a `result` boolean field
|
| 32 |
-
- Return `false` when violations are detected
|
| 33 |
-
- Return `true` when all Roles are compliant
|
| 34 |
-
- Exclude benchmark-related Roles from violation detection
|
| 35 |
-
|
| 36 |
-
## Environment Information
|
| 37 |
-
|
| 38 |
-
- **Static Resources Path**: `./static-resources`
|
| 39 |
-
- **Test Namespace**: `k8s-opa-static-cis-513-1772801858`
|
| 40 |
-
|
| 41 |
-
## Expected Behavior
|
| 42 |
-
|
| 43 |
-
Your implementation should:
|
| 44 |
-
1. Parse Kubernetes Role resources from static YAML files
|
| 45 |
-
2. Identify Roles that use wildcard patterns inappropriately
|
| 46 |
-
3. Exclude legitimate benchmark Roles from violation detection
|
| 47 |
-
4. Return appropriate compliance status via OPA evaluation
|
| 48 |
-
|
| 49 |
-
## Execution Context
|
| 50 |
-
|
| 51 |
-
The evaluation system will run your implementation as follows:
|
| 52 |
-
```bash
|
| 53 |
-
./fetch.sh
|
| 54 |
-
cat collected_data.json | opa eval -d policy.rego -I 'data.check.result'
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
The result should be a boolean value indicating compliance status.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
snapshots/ciso/v0.1/k8s-opa-static-cis-5.1.3/static-resources-compliant/deployments-all.yaml
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
apiVersion: v1
|
| 2 |
-
items:
|
| 3 |
-
- apiVersion: apps/v1
|
| 4 |
-
kind: Deployment
|
| 5 |
-
metadata:
|
| 6 |
-
annotations:
|
| 7 |
-
deployment.kubernetes.io/revision: "1"
|
| 8 |
-
kubectl.kubernetes.io/last-applied-configuration: |
|
| 9 |
-
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"test-app"},"name":"test-deployment","namespace":"k8s-opa-static-cis-513"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"test-app"}},"template":{"metadata":{"labels":{"app":"test-app"}},"spec":{"containers":[{"image":"nginx:1.21","name":"nginx","ports":[{"containerPort":80}]}],"serviceAccountName":"reader-sa"}}}}
|
| 10 |
-
creationTimestamp: "2026-03-06T11:33:15Z"
|
| 11 |
-
generation: 1
|
| 12 |
-
labels:
|
| 13 |
-
app: test-app
|
| 14 |
-
name: test-deployment
|
| 15 |
-
namespace: k8s-opa-static-cis-513
|
| 16 |
-
resourceVersion: "3016060"
|
| 17 |
-
uid: 71fa3632-845c-4724-9e11-a05a3e6f6eaf
|
| 18 |
-
spec:
|
| 19 |
-
progressDeadlineSeconds: 600
|
| 20 |
-
replicas: 1
|
| 21 |
-
revisionHistoryLimit: 10
|
| 22 |
-
selector:
|
| 23 |
-
matchLabels:
|
| 24 |
-
app: test-app
|
| 25 |
-
strategy:
|
| 26 |
-
rollingUpdate:
|
| 27 |
-
maxSurge: 25%
|
| 28 |
-
maxUnavailable: 25%
|
| 29 |
-
type: RollingUpdate
|
| 30 |
-
template:
|
| 31 |
-
metadata:
|
| 32 |
-
creationTimestamp: null
|
| 33 |
-
labels:
|
| 34 |
-
app: test-app
|
| 35 |
-
spec:
|
| 36 |
-
containers:
|
| 37 |
-
- image: nginx:1.21
|
| 38 |
-
imagePullPolicy: IfNotPresent
|
| 39 |
-
name: nginx
|
| 40 |
-
ports:
|
| 41 |
-
- containerPort: 80
|
| 42 |
-
protocol: TCP
|
| 43 |
-
resources: {}
|
| 44 |
-
terminationMessagePath: /dev/termination-log
|
| 45 |
-
terminationMessagePolicy: File
|
| 46 |
-
dnsPolicy: ClusterFirst
|
| 47 |
-
restartPolicy: Always
|
| 48 |
-
schedulerName: default-scheduler
|
| 49 |
-
securityContext: {}
|
| 50 |
-
serviceAccount: reader-sa
|
| 51 |
-
serviceAccountName: reader-sa
|
| 52 |
-
terminationGracePeriodSeconds: 30
|
| 53 |
-
status:
|
| 54 |
-
availableReplicas: 1
|
| 55 |
-
conditions:
|
| 56 |
-
- lastTransitionTime: "2026-03-06T11:33:16Z"
|
| 57 |
-
lastUpdateTime: "2026-03-06T11:33:16Z"
|
| 58 |
-
message: Deployment has minimum availability.
|
| 59 |
-
reason: MinimumReplicasAvailable
|
| 60 |
-
status: "True"
|
| 61 |
-
type: Available
|
| 62 |
-
- lastTransitionTime: "2026-03-06T11:33:15Z"
|
| 63 |
-
lastUpdateTime: "2026-03-06T11:33:16Z"
|
| 64 |
-
message: ReplicaSet "test-deployment-647f6b8c5d" has successfully progressed.
|
| 65 |
-
reason: NewReplicaSetAvailable
|
| 66 |
-
status: "True"
|
| 67 |
-
type: Progressing
|
| 68 |
-
observedGeneration: 1
|
| 69 |
-
readyReplicas: 1
|
| 70 |
-
replicas: 1
|
| 71 |
-
updatedReplicas: 1
|
| 72 |
-
kind: List
|
| 73 |
-
metadata:
|
| 74 |
-
resourceVersion: ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|