ROCm / ROCm/rocm-cli

runtime_install_root_is_protected is a denylist, not an allowlist

Open
#189 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
40
Forks
9
Avg merge
4d 20h
Merged PRs (30d)
59

Description

Problem

runtime_install_root_is_protected (crates/rocm-core/src/runtime.rs) decides whether a runtime folder sits somewhere too dangerous to delete by enumerating known-bad locations. That means anything it has not thought of is treated as safe. It returns false for $HOME exactly, and for /home, /mnt, /srv and /media; the Windows branch hardcodes C:, so another drive letter is unprotected.

Nothing reaches those gaps today: deletion additionally requires a matching in-tree .rocm-cli-runtime.json whose runtime_key, runtime_id and install_root all agree, which a copied or moved tree does not satisfy. So this is a defence-in-depth guard rather than a live bug.

Why it matters now

rocm storage remove-old-installs (#172) leans on this guard for a set of folders the user never typed out, which is a different risk profile from rocm runtimes uninstall naming one. Belt-and-braces guards are worth having actually hold.

Suggested direction

Invert it: require the folder to be under a known ROCm CLI data root (or otherwise positively established as ours) rather than merely not matching a list of bad places. Platform-independent handling for Windows drive roots too.

Context

Out of scope for #172. Raised from review feedback on that PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/rocm-core/src/runtime.rs and trace how runtime_install_root_is_protected is used by rocm storage remove-old-installs. Establish the known ROCm CLI data roots and review the Windows handling, then verify that only positively established locations are protected from deletion, including roots on drives other than C:.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.