[Low] CleanupSandboxState joins an unchecked id into paths it RemoveAll()s
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read cmd/ateworker-microvm/internal/kata/cleanup_linux.go, starting at CleanupSandboxState and its os.RemoveAll calls. Add the suggested ID validation and unit tests for "", "." and ".."; done means invalid IDs cannot make cleanup target parent directories and the tests pass.
Written by the indexing model from the issue text.
Description
Summary
kata.CleanupSandboxState builds /run/kata-containers/shared/sandboxes/<id> and <vcVMDir>/<id> with filepath.Join and later os.RemoveAlls them, without checking that id is non-empty and a single path element. Every current caller passes a UUID-validated actor UID, so this is defense in depth.
Details
cmd/ateworker-microvm/internal/kata/cleanup_linux.go#L50-L54:
func CleanupSandboxState(ctx context.Context, id string) {
dirs := []string{
filepath.Join("/run/kata-containers/shared/sandboxes", id),
filepath.Join(vcVMDir, id),
}
and #L96-L99:
if err := os.RemoveAll(d); err != nil {
slog.WarnContext(ctx, "Failed to remove leftover sandbox dir",
slog.String("dir", d), slog.Any("err", err))
}
With id == "" the targets are the parent directories themselves. With id == ".." they are their parents.
Impact
Low: not reachable today, because ateworkervalidation checks the actor UID at every ateworker-microvm RPC entry point (run.go, restore.go, checkpoint.go). A future caller that passes an unvalidated or empty ID would wipe the shared state of every sandbox on the node.
Suggested fix
At the top of CleanupSandboxState, return early (and log) unless id != "" && filepath.IsLocal(id) && filepath.Base(id) == id, or parse it as a UUID. Add a unit test for "", . and ...
- Dominant language
- Go
- Stars
- 5.7k
- Forks
- 612
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 533
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from agent-substrate/substrate
-
area/security kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
agent-substrate/substrate#2935 ·
Maintainers usually reply within 1 day
-
[Low] guestVolumeSource can map host paths containing ".." outside the microVM guest sharePossibly taken @jiayimeow claimed this 1 day ago. Openarea/security kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
agent-substrate/substrate#2920 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Low] setupImageVolumes builds host mount paths from vol.Name without a containment checkPossibly taken @abhisheksharma2411 claimed this today. Openarea/security kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
agent-substrate/substrate#2919 ·
Maintainers usually reply within 1 day
-
[Low] ate-api-server accepts client certificates chained to system roots when --pod-identity-ca-certs is unsetPossibly taken @abhisheksharma2411 claimed this today. Openarea/security kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
agent-substrate/substrate#2918 ·
Maintainers usually reply within 1 day
-
Cloud SQL backend: document (and optionally provision) Private Service Connect for ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=pscPossibly taken A pull request linked to this issue is open or already merged. Openarea/dev-infra kind/docs kind/feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
agent-substrate/substrate#2875 ·
Maintainers usually reply within 1 day
All issues in agent-substrate/substrate
Similar issues
-
cleanup hacktoberfest priority: low skill: good first issue testing
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hyperledger-labs/fabric-smart-client#2197 ·
Maintainers usually reply within 1 day
-
New term request
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
geneontology/go-ontology#32791 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
aws/amazon-ecs-agent#5177 ·
Maintainers usually reply within 2 days
-
release-followup
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day