Last active
March 31, 2026 08:16
-
-
Save cmaneu/87de57c7d3b79aa2a58b6b661d739fe9 to your computer and use it in GitHub Desktop.
detect-compromised-axios.ps1
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
| param( | |
| [string]$Directory = "." | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| $repos = Get-ChildItem -Path $Directory -Directory | |
| foreach ($repo in $repos) { | |
| $packageJson = Join-Path $repo.FullName "package.json" | |
| if (-not (Test-Path $packageJson)) { | |
| continue | |
| } | |
| try { | |
| $matches = Push-Location $repo.FullName | |
| try { | |
| npm ls axios 2>$null | Select-String -Pattern 'axios@(1\.14\.1|0\.30\.4)' | |
| } | |
| finally { | |
| Pop-Location | |
| } | |
| } | |
| catch { | |
| $matches = $null | |
| } | |
| if ($matches) { | |
| Write-Host "" | |
| Write-Host "############################################" | |
| Write-Host "## COMPROMISED AXIOS VERSION DETECTED !!! ##" | |
| Write-Host "############################################" | |
| Write-Host "" | |
| Write-Host "Repository: $($repo.FullName)" | |
| Write-Host $matches | |
| Write-Host "" | |
| exit 1 | |
| } | |
| } | |
| Write-Host "All clean, no compromised axios versions found." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment