Test: Fail the provenance contract when a case writes into the real nvm tree

This commit is contained in:
Gabriel Brown
2026-09-22 14:04:32 -04:00
parent 05054afdc9
commit 43ae5bb53b
+9
View File
@@ -105,6 +105,13 @@ before_system_flatpak="$(snapshot_file_state /var/lib/flatpak/repo/config)"
before_system_flathub_key="$(snapshot_file_state /var/lib/flatpak/repo/flathub.trustedkeys.gpg)"
before_user_flatpak="$(snapshot_file_state "$HOME/.local/share/flatpak/repo/config")"
before_bashrc="$(snapshot_file_state "$HOME/.bashrc")"
# A runtime case that escapes its case_root writes a fixture node into the real
# nvm tree, and the real installer then refuses that unreceipted directory on
# every later update. Snapshot the listing so the escape fails here instead.
snapshot_nvm_node() {
find "${NVM_DIR:-$HOME/.nvm}/versions/node" -printf '%P %s %T@\n' 2>/dev/null | sort
}
before_nvm_node="$(snapshot_nvm_node)"
# Runtime and agent installs must consume the reviewed provenance table. Keep
# this scan at the public script boundary because a command hidden elsewhere in
@@ -2064,5 +2071,7 @@ STUB_DNF_FAIL_MATCH=terra-release expect_failure run_installer_function terra-dn
|| fail 'repository cases changed the user Flatpak remote'
[[ "$before_bashrc" == "$(snapshot_file_state "$HOME/.bashrc")" ]] \
|| fail 'repository cases changed the protected bashrc'
[[ "$before_nvm_node" == "$(snapshot_nvm_node)" ]] \
|| fail 'runtime cases wrote into the real nvm node tree'
printf 'package provenance contract: PASS\n'