Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use container as cause in KSV104 check #304

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nikpivkin
Copy link
Contributor

We should only use objects as causes in kubernetes checks , since only they contain the locations used to display the findings.

Config:

---
apiVersion: v1
kind: Pod
metadata:
  name: hello-sysctls
spec:
  containers:
  - name: hello
    image: busybox
    command:
    - sh
    - "-c"
    - echo 'Hello' && sleep 1h
    securityContext:
      seccompProfile:
        type: Unconfined

Before:

AVD-KSV-0104 (MEDIUM): container "hello" of pod "hello-sysctls" in "default" namespace should specify a seccomp profile
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
A program inside the container can bypass Seccomp protection policies.

See https://avd.aquasec.com/misconfig/ksv104
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 test.yaml:1
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1 [ ---
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

After:

AVD-KSV-0104 (MEDIUM): container "hello" of pod "hello-sysctls" in "default" namespace should specify a seccomp profile
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
A program inside the container can bypass Seccomp protection policies.

See https://avd.aquasec.com/misconfig/ksv104
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 test.yaml:8-16
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   8 ┌   - name: hello
   9 │     image: busybox
  10 │     command:
  11 │     - sh
  12 │     - "-c"
  13 │     - echo 'Hello' && sleep 1h
  14 │     securityContext:
  15 │       seccompProfile:
  16 └         type: Unconfined
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@nikpivkin nikpivkin marked this pull request as ready for review December 19, 2024 12:00
@nikpivkin nikpivkin requested a review from simar7 as a code owner December 19, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant