CheckBot: Update upstream scripts - #113
Merged
Merged
Conversation
There was a problem hiding this comment.
Script Analysis
- The diff shows changes to PowerShell and Unix shell scripts that create a
moonxexecutable as a hard link (Windows) or symlink (Unix) to the mainmoonexecutable - These are traditional shell scripts, not Nushell scripts, so Nu-specific features don't apply directly
- The changes appear to be part of a MoonBit language toolchain installation process
- The Unix script uses
ln -sfnwhich is a GNU-specific flag; may not work on macOS/BSD systems
Security Review
- ❌ Command injection risk: The Unix script uses
$bin_dir/moonxwithout quoting, which could lead to path injection if$bin_dircontains spaces or special characters - ❌ Unsafe removal pattern:
rm -rf "${moon_home:?}/include"uses the${var:?}safety pattern, but the newlncommand doesn't have similar safeguards ⚠️ Race condition: The PowerShell script removes$MoonxExethen creates a hard link, but there's a TOCTOU (time-of-check-time-of-use) vulnerability between theTest-PathandRemove-Itemoperations⚠️ No validation: Neither script validates that$MoonExe/moonactually exists before creating the link, which could create dangling references⚠️ Privilege escalation potential: If$MoonBinis writable by non-privileged users, an attacker could replace the target before the link is created
Optimization Suggestions
- Use atomic operations: Replace the separate remove+create with a single force operation to avoid race conditions
- Add existence checks: Validate the source executable exists before creating links
- Improve cross-platform compatibility: The Unix
ln -sfnflag-n(no dereference) is GNU-specific; consider using-sffor broader compatibility or add a fallback - Quote all variables: In the Unix script, quote
"$bin_dir/moonx"to prevent word splitting - Consider error handling: The PowerShell script uses
| Out-Nullwhich suppresses errors; consider using-ErrorAction Stopfor better error propagation
Overall Quality: 2/5
The changes introduce functional improvements but have significant security concerns including command injection vectors, race conditions, and lack of input validation. The cross-platform compatibility issues could cause silent failures on macOS systems.
hustcer
added a commit
that referenced
this pull request
Jul 21, 2026
Align nu/moonbit.nu with .scripts/unix.sh & powershell.ps1 on feature/latest: - Add moonx link creation after toolchain extraction (upstream #113): a relative 'ln -sfn moon' symlink on Unix, and a hard link to moon.exe on Windows after removing any existing moonx.exe - Drop AGENTS.md linking to the moon-pilot prompt, removed upstream (#104)
hustcer
added a commit
that referenced
this pull request
Jul 21, 2026
* feat: Sync moonbit.nu with latest upstream install scripts Align nu/moonbit.nu with .scripts/unix.sh & powershell.ps1 on feature/latest: - Add moonx link creation after toolchain extraction (upstream #113): a relative 'ln -sfn moon' symlink on Unix, and a hard link to moon.exe on Windows after removing any existing moonx.exe - Drop AGENTS.md linking to the moon-pilot prompt, removed upstream (#104) * ci skip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the upstream scripts to the latest revision.