-
Notifications
You must be signed in to change notification settings - Fork 2
chore: adopt official curl installer for Claude Code CLI setup #1432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||
| #!/bin/bash | ||||||||||||
| # Claude Code configuration script | ||||||||||||
| # Primary purpose: Configure Claude Code CLI with MCP servers and settings | ||||||||||||
| # Secondary purpose: Install Claude Code if not present (trivial npm install) | ||||||||||||
| # Secondary purpose: Install Claude Code if not present (one-line curl install) | ||||||||||||
| # | ||||||||||||
| # Configuration is the interesting problem - installation is a solved problem | ||||||||||||
|
|
||||||||||||
|
|
@@ -54,17 +54,6 @@ configure_claude_code() { | |||||||||||
| # Installation is a one-time solved problem, configuration is ongoing | ||||||||||||
| # ============================================================================ | ||||||||||||
| install_claude_if_needed() { | ||||||||||||
| # Check prerequisites | ||||||||||||
| if ! command -v node &> /dev/null; then | ||||||||||||
| echo -e "${RED}Node.js is not installed. Please install Node.js first.${NC}" | ||||||||||||
| return 1 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| if ! command -v npm &> /dev/null; then | ||||||||||||
| echo -e "${RED}npm is not installed. Please install npm first.${NC}" | ||||||||||||
| return 1 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| # Check if Claude Code is already installed | ||||||||||||
| # Use type -P to ignore aliases and confirm the actual binary exists | ||||||||||||
| if type -P claude &> /dev/null; then | ||||||||||||
|
|
@@ -74,10 +63,15 @@ install_claude_if_needed() { | |||||||||||
| return 0 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| # Perform the trivial installation | ||||||||||||
| echo "Installing Claude Code CLI (one-time setup)..." | ||||||||||||
| if ! npm install -g @anthropic-ai/claude-code; then | ||||||||||||
| echo -e "${RED}Failed to install Claude Code CLI. Please try again or check your npm installation.${NC}" | ||||||||||||
| # Perform the one-line curl installation | ||||||||||||
| if ! command -v curl &> /dev/null; then | ||||||||||||
| echo -e "${RED}curl is not installed. Please install curl first.${NC}" | ||||||||||||
| return 1 | ||||||||||||
| fi | ||||||||||||
|
|
||||||||||||
| echo "Installing Claude Code CLI via official install script..." | ||||||||||||
| if ! curl -fsSL https://claude.ai/install.sh | bash; then | ||||||||||||
| echo -e "${RED}Failed to install Claude Code CLI. Please try again or check your network connectivity.${NC}" | ||||||||||||
| return 1 | ||||||||||||
| fi | ||||||||||||
|
Comment on lines
75
to
76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing cleanup of temporary file. The temporary install script should be removed after execution to prevent leaving sensitive files on the filesystem.
Suggested change
|
||||||||||||
| hash -r # ensure the shell picks up the newly installed binary | ||||||||||||
|
|
||||||||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Security Vulnerability: Piping curl output directly to bash without verification creates a significant security risk. The script downloads and executes code from without any integrity checks, certificate validation, or content verification.