Skip to content

🔒 fix: prevent remote script execution in mermaid nodejs install#232

Merged
MiguelRodo merged 3 commits into
mainfrom
fix-mermaid-node-install-4781506545663449927
May 18, 2026
Merged

🔒 fix: prevent remote script execution in mermaid nodejs install#232
MiguelRodo merged 3 commits into
mainfrom
fix-mermaid-node-install-4781506545663449927

Conversation

@MiguelRodo
Copy link
Copy Markdown
Owner

🎯 What: The vulnerability fixed
The src/mermaid/install.sh script previously installed Node.js by directly piping remote NodeSource setup scripts into bash (e.g. curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -).

⚠️ Risk: The potential impact if left unfixed
Piping remote scripts into bash is inherently insecure as it can execute truncated, intercepted, or otherwise malicious scripts directly as root without any prior hash validation or integrity check, allowing arbitrary code execution.

🛡️ Solution: How the fix addresses the vulnerability
This patch replaces the unsafe remote script execution entirely with NodeSource's recommended manual repository configuration. For the lts version tag, it safely parses the correct numeric version (NODE_VERSION) from the setup script using text processing tools (grep/cut). The patch creates the respective APT configuration (/etc/apt/sources.list.d/nodesource.list) using an ASCII-armored GPG key (.asc to prevent gnupg dependencies), and the equivalent YUM/DNF configuration (/etc/yum.repos.d/nodesource-nodejs.repo), removing the vulnerability.


PR created automatically by Jules for task 4781506545663449927 started by @MiguelRodo

…ttern for the NodeSource installation. Here is a summary of the updates I made:

- Removed remote script execution via `curl | bash` in `install_nodejs` for NodeSource.
- Dynamically resolves the `lts` numeric major version safely using standard command-line text processing.
- Sets up APT and YUM repositories natively via `/etc/apt/sources.list.d/` and `/etc/yum.repos.d/`.
- Uses `.asc` armored key files for APT to avoid relying on the `gnupg` utility.

Co-authored-by: MiguelRodo <23501332+MiguelRodo@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits May 15, 2026 21:22
…approach for the NodeSource installation. Here is a summary of the changes I made:

- Removed remote script execution via `curl | bash` in `install_nodejs` for NodeSource.
- Dynamically resolved the `lts` numeric major version safely using standard text processing utilities.
- Set up APT and YUM repositories natively via `/etc/apt/sources.list.d/` and `/etc/yum.repos.d/`.
- Used `.asc` armored key files for APT to avoid relying on the `gnupg` utility.
- Resolved the merge conflicts and cleaned up the workspace.

Co-authored-by: MiguelRodo <23501332+MiguelRodo@users.noreply.github.com>
@MiguelRodo MiguelRodo merged commit 2c52dc5 into main May 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant