BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback

HostPath Volume Mounted

Description

Detects HostPath volumes that mount directories from the host filesystem into pods.

What Shoulder detects

HostPath volumes mount directories from the host filesystem into the pod.

How to fix

Use PersistentVolumeClaim or emptyDir instead of hostPath.

```yaml
volumes:
  - name: data
    persistentVolumeClaim:
      claimName: my-pvc
```

Learn more: https://shoulder.dev/learn/kubernetes/cwe-668/hostpath-volume

Applies to

Languages

Frameworks

kubernetes

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=kubernetes-hostpath-volume .

Related rules