GoogleCloudPlatform / GoogleCloudPlatform/key-protection-module
Unnecessary UDS Bind Mount (/tmp/container_launcher/) in image/kps_runner.sh
- Dominant language
- Go
- Stars
- 4
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
### Problem Description
In `image/kps_runner.sh`, the container launcher runs `ctr run` with the following bind mount:
`--mount "type=bind,src=/tmp/container_launcher/,dst=/run/container_launcher/,options=rbind:rw"`
However, `kps_runner.sh` explicitly sets:
- `SERVICE_ROLE="SERVICE_ROLE_KPS"`
- `KEY_PROTECTION_MECHANISM="KEY_PROTECTION_VM"`
Under `SERVICE_ROLE_KPS` and `KEY_PROTECTION_VM`, the agent binary (`cmd/agent/main.go`) initializes `runKps()`, which listens exclusively on network gRPC over TCP port `50050` (`--net-host`). It never opens or communicates over the Unix Domain Socket at `/run/container_launcher/kmaserver.sock` (which is used by `runWsd()` on the Workload VM in Vanguard/WSD mode).
### Impact & Security Risk
Exposing `/tmp/container_launcher/` as read-write (`rbind:rw`) to the KPS container introduces:
1. **Unnecessary Host Attack Surface:** Exposes host `/tmp/` filesystem state to the container.
2. **Directory Pollution Vector:** Allows potential container processes to write symlinks/files or exhaust disk inodes on host `/tmp`.
### Recommended Remediation
Remove the `--mount "type=bind,src=/tmp/container_launcher/,dst=/run/container_launcher/,options=rbind:rw"` argument from `image/kps_runner.sh`.
### Context
Referenced in PR #66 (https://github.com/GoogleCloudPlatform/key-protection-module/pull/66).
Contributor guide
Research direction
Start in image/kps_runner.sh and inspect the ctr run command containing the /tmp/container_launcher/ bind mount. Read cmd/agent/main.go around runKps() and runWsd() to confirm the KPS path uses network gRPC rather than the Unix socket. Done means the KPS launcher no longer exposes that bind mount and its resulting command remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, shell
- Domain
- infrastructure, security
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100