Test: Fail the provenance contract when a case writes into the real nvm tree
This commit is contained in:
@@ -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_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_user_flatpak="$(snapshot_file_state "$HOME/.local/share/flatpak/repo/config")"
|
||||||
before_bashrc="$(snapshot_file_state "$HOME/.bashrc")"
|
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
|
# Runtime and agent installs must consume the reviewed provenance table. Keep
|
||||||
# this scan at the public script boundary because a command hidden elsewhere in
|
# 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'
|
|| fail 'repository cases changed the user Flatpak remote'
|
||||||
[[ "$before_bashrc" == "$(snapshot_file_state "$HOME/.bashrc")" ]] \
|
[[ "$before_bashrc" == "$(snapshot_file_state "$HOME/.bashrc")" ]] \
|
||||||
|| fail 'repository cases changed the protected 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'
|
printf 'package provenance contract: PASS\n'
|
||||||
|
|||||||
Reference in New Issue
Block a user