Interactive Playground
Experiment with the vulnerable code and security rule below. Edit the code to see how the rule detects different vulnerability patterns.
pathfinder scan --ruleset docker-compose/COMPOSE-SEC-006 --project .About This Rule
Understanding the vulnerability and how it is detected
This rule detects services without `read_only: true` filesystem setting. While containers have writable filesystems by default for compatibility, making the root filesystem read-only significantly improves security by preventing attackers from modifying binaries, installing malware, or persisting backdoors within the container.
SECURITY BENEFITS OF READ-ONLY FILESYSTEMS:
1. **Prevents Malware Installation**: Attackers cannot write persistent backdoors or rootkits to the filesystem.
2. **Blocks Binary Modification**: Cannot replace legitimate binaries with trojanized versions.
3. **Immutable Infrastructure**: Enforces that containers are disposable and stateless.
4. **Reduces Attack Persistence**: Malware must remain in memory only, lost on container restart.
How to Fix
Recommended remediation steps
- 1Review your Dockerfile to address the container filesystem is writable issue
- 2Follow Docker official best practices for image building
- 3Use docker build --check to validate Dockerfile syntax and best practices
References
External resources and documentation
Similar Rules
Explore related security rules for Docker Compose
Using Host IPC Mode
Service uses host IPC namespace. Container shares inter-process communication with host.
Missing no-new-privileges Security Option
Service does not have no-new-privileges security option. Without this, processes inside the container can gain additional privileges via setuid binaries or capability escalation.
SELinux Separation Disabled
Service has label:disable in security_opt, which disables SELinux mandatory access control. This removes an important defense-in-depth layer for container isolation.
Frequently Asked Questions
Common questions about Container Filesystem is Writable
New feature
Get these findings posted directly on your GitHub pull requests
The Container Filesystem is Writable rule runs in CI and posts inline review comments on the exact lines — no dashboard, no SARIF viewer.