fix(security): replace NodeSource setup script with direct apt repo config#742
fix(security): replace NodeSource setup script with direct apt repo config#742brianwtaylor wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…onfig Replace `curl | sudo bash` of NodeSource's setup_22.x script with GPG key import + apt source configuration. This eliminates execution of a third-party shell script as root — the same pattern already used for the NVIDIA Container Toolkit in brev-setup.sh (lines 61-65).
📝 WalkthroughWalkthroughBoth installation scripts replace remote Nodesource setup script piping with explicit GPG key management and signed APT repository configuration. The changes add GPG key import, dearmor operations, and repository entry creation before running apt-get update and nodejs installation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/brev-setup.sh (1)
39-43: Good security improvement: explicit GPG key handling replacescurl | bash.This correctly follows the same pattern as the NVIDIA Container Toolkit setup below (lines 65-69). The
signed-bydirective ensures apt verifies package signatures against the imported key.One minor consideration: if the script fails mid-execution and is re-run while
nodeis still not installed,gpg --dearmor -o /usr/share/keyrings/nodesource.gpgwill fail because the file already exists. Consider adding--yesto overwrite or removing the file first for idempotency:curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \ - | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg + | sudo gpg --batch --yes --dearmor -o /usr/share/keyrings/nodesource.gpgThis matches better shell script practices for re-runnability, though the existing NVIDIA toolkit block has the same pattern.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/brev-setup.sh` around lines 39 - 43, The gpg dearmor step (curl ... | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg) is not idempotent and will fail if /usr/share/keyrings/nodesource.gpg already exists; make the nodesource key import idempotent by either removing the existing /usr/share/keyrings/nodesource.gpg before running gpg --dearmor or invoking gpg with an overwrite flag (e.g., --yes) when writing the key, and ensure the subsequent creation of /etc/apt/sources.list.d/nodesource.list still uses the signed-by directive as shown.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@scripts/brev-setup.sh`:
- Around line 39-43: The gpg dearmor step (curl ... | sudo gpg --dearmor -o
/usr/share/keyrings/nodesource.gpg) is not idempotent and will fail if
/usr/share/keyrings/nodesource.gpg already exists; make the nodesource key
import idempotent by either removing the existing
/usr/share/keyrings/nodesource.gpg before running gpg --dearmor or invoking gpg
with an overwrite flag (e.g., --yes) when writing the key, and ensure the
subsequent creation of /etc/apt/sources.list.d/nodesource.list still uses the
signed-by directive as shown.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8433bdf5-8f2c-43af-a953-26c806874fe6
📒 Files selected for processing (2)
scripts/brev-setup.shscripts/install.sh
|
Thanks for submitting this PR, it addresses a security issue by replacing the NodeSource setup script with a more secure approach using apt repo config, which improves the overall security of the NemoClaw installation process. |
|
Please rebase this PR against the latest main. |
Summary
Replace
curl | sudo bashof NodeSource'ssetup_22.xscript with GPG key import + apt source configuration in bothscripts/brev-setup.shandscripts/install.sh.This eliminates execution of a third-party shell script as root entirely. Instead, Node.js is installed via apt's built-in GPG signature verification — the same pattern already used for the NVIDIA Container Toolkit in
brev-setup.sh(lines 61–65).scripts/brev-setup.shsetup_22.x→ GPG key + apt sourcescripts/install.shsetup_22.x→ GPG key + apt sourceTest plan
scripts/install.shon Linux withNODE_MGR=nodesourceinstalls Node.js 22 correctlyscripts/brev-setup.shon fresh Brev VM installs Node.js correctly/usr/share/keyrings/nodesource.gpgand/etc/apt/sources.list.d/nodesource.listare creatednode --versionreports v22.x after installSummary by CodeRabbit