From c07e8722a1dc93f4f9c1ccfe9ef2cf628b053025 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Oct 2026 23:14:46 -0700 Subject: [PATCH] [Tests] `nvm_get_arch_unofficial`: set `NVM_DIR` when sourcing `nvm.sh` in the chroots The chroot checks source `nvm.sh` from `/bin/sh` without `NVM_DIR`, so nvm has to guess it: today from `dirname "$0"`, which is `/bin` here. That guess is incidental to what the test checks (architecture detection), so set `NVM_DIR` explicitly to the directory the chroot's `nvm.sh` lives in, as the README instructs Discovered by Anthropic's OSS Scanner, as ANT-2026-8RIT0MGO; the scanner reported it as a vulnerability, but it is not one. --- test/fast/Unit tests/nvm_get_arch_unofficial | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fast/Unit tests/nvm_get_arch_unofficial b/test/fast/Unit tests/nvm_get_arch_unofficial index cc10bf3c..af1557b5 100755 --- a/test/fast/Unit tests/nvm_get_arch_unofficial +++ b/test/fast/Unit tests/nvm_get_arch_unofficial @@ -70,10 +70,10 @@ else setup_chroot "${CHROOT_WITHOUT_ALPINE}" # Run tests in chroot environments - ARCH_WITH_ALPINE=$(sudo chroot "${CHROOT_WITH_ALPINE}" /bin/sh -c ". ./nvm.sh && nvm_get_arch") + ARCH_WITH_ALPINE=$(sudo chroot "${CHROOT_WITH_ALPINE}" /bin/sh -c "export NVM_DIR=/ && . ./nvm.sh && nvm_get_arch") [ "${ARCH_WITH_ALPINE}" = "x64-musl" ] || die "Expected x64-musl for alpine environment but got ${ARCH_WITH_ALPINE}" - ARCH_WITHOUT_ALPINE=$(sudo chroot "${CHROOT_WITHOUT_ALPINE}" /bin/sh -c ". ./nvm.sh && nvm_get_arch") + ARCH_WITHOUT_ALPINE=$(sudo chroot "${CHROOT_WITHOUT_ALPINE}" /bin/sh -c "export NVM_DIR=/ && . ./nvm.sh && nvm_get_arch") [ "${ARCH_WITHOUT_ALPINE}" != "x64-musl" ] || die "Did not expect x64-musl for non-alpine environment" fi