Skip to content
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

fix(scoop-install): Prevent installation of Scoop itself #6158

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- **scoop-download|install|update:** Fallback to default downloader when aria2 fails ([#4292](https://github.com/ScoopInstaller/Scoop/issues/4292))
- **decompress**: `Expand-7zipArchive` only delete temp dir / `$extractDir` if it is empty ([#6092](https://github.com/ScoopInstaller/Scoop/issues/6092))
- **commands**: Handling broken aliases ([#6141](https://github.com/ScoopInstaller/Scoop/issues/6141))
- **scoop-install**: Prevent installation of Scoop itself ([#6158](https://github.com/ScoopInstaller/Scoop/issues/6158))

### Code Refactoring

Expand Down
7 changes: 7 additions & 0 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ try {

if (!$apps) { error '<app> missing'; my_usage; exit 1 }

# Prevent installation of Scoop itself
foreach ($app in $apps) {
if (($app -eq 'scoop') -or ($app -match '.*/scoop$')) {
abort "ERROR: You cannot install Scoop via 'scoop install'"
}
}

if ($global -and !(is_admin)) {
abort 'ERROR: you need admin rights to install global apps'
}
Expand Down