refactor(scenarios): split monolithic configuration into individual files
- Split `scenarios/scenarios.json` into individual JSON files under `scenarios/data/` named `<scenario-id>.json` - Split `scenarios/bundles.json` into individual JSON files under `scenarios/bundles/` named `<bundle-id>.json` - Updated `backend/server.js` to dynamically load scenario and bundle files from their respective directories - Updated documentation in `scenarios/SCHEMA.md` and `README.md` to reflect the new repository layout and contributor workflow Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"id": "cks-pod-security-context",
|
||||
"title": "Pod Security Context",
|
||||
"category": "Workload Security",
|
||||
"difficulty": "Medium",
|
||||
"type": "task",
|
||||
"weight": 5,
|
||||
"description": "## Restricting Container Privileges\n\nContainers run as root by default, which is a major security risk.\n\n**Your task:**\n\nCreate a Pod named `secure-pod` using the `busybox:1.36` image (command: `sleep 3600`). Configure its security context so that it runs as user ID `1000`, runs as group ID `3000`, and sets `allowPrivilegeEscalation: false` at the container level.\n\n```bash\n# Check the security context of your pod\nkubectl get pod secure-pod -o yaml\n```",
|
||||
"hints": [
|
||||
{
|
||||
"title": "Security Context Fields",
|
||||
"body": "You need `securityContext` at the Pod level for `runAsUser` and `runAsGroup`, and at the Container level for `allowPrivilegeEscalation`.",
|
||||
"command": "cat <<EOF | kubectl apply -f -\napiVersion: v1\nkind: Pod\nmetadata:\n name: secure-pod\nspec:\n securityContext:\n runAsUser: 1000\n runAsGroup: 3000\n containers:\n - name: app\n image: busybox:1.36\n command: [\"sleep\", \"3600\"]\n securityContext:\n allowPrivilegeEscalation: false\nEOF"
|
||||
}
|
||||
],
|
||||
"setup_commands": [],
|
||||
"validation": {
|
||||
"commands": [
|
||||
{
|
||||
"description": "Pod secure-pod runs as user 1000",
|
||||
"command": "kubectl get pod secure-pod -o jsonpath='{.spec.securityContext.runAsUser}'",
|
||||
"expected_output": "1000",
|
||||
"match": "exact"
|
||||
},
|
||||
{
|
||||
"description": "allowPrivilegeEscalation is false",
|
||||
"command": "kubectl get pod secure-pod -o jsonpath='{.spec.containers[0].securityContext.allowPrivilegeEscalation}'",
|
||||
"expected_output": "false",
|
||||
"match": "exact"
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_namespace": "default",
|
||||
"teardown_commands": [
|
||||
{
|
||||
"command": "kubectl delete pod secure-pod --ignore-not-found --grace-period=0 --force"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user