Skip to content

Instantly share code, notes, and snippets.

@cmaneu
Last active March 31, 2026 08:16
Show Gist options
  • Select an option

  • Save cmaneu/87de57c7d3b79aa2a58b6b661d739fe9 to your computer and use it in GitHub Desktop.

Select an option

Save cmaneu/87de57c7d3b79aa2a58b6b661d739fe9 to your computer and use it in GitHub Desktop.
detect-compromised-axios.ps1
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