Skip to content

Commit ef077ff

Browse files
committed
trying to parse out dontetzip
1 parent 084cded commit ef077ff

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

check-vulnerabilities.ps1

+13-8
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ $cmd = "list", "package", "--include-transitive", "--vulnerable"
1616
Write-Host "dotnet $cmd"
1717
dotnet $cmd | Tee-Object $logFilePath
1818

19-
# Filter out lines containing DotNetZip
20-
Get-Content $logFilePath | Where-Object { $_ -notmatch "DotNetZip" } | Set-Content $filteredLogFilePath
19+
# Read log and filter vulnerabilities
20+
$logContent = Get-Content $logFilePath
2121

22-
# Check for remaining vulnerabilities
23-
$vulnerabilities = Get-Content $filteredLogFilePath | Where-Object { $_ -match "Vulnerable Packages found" }
22+
# Extract vulnerabilities excluding DotNetZip
23+
$vulnerabilities = $logContent | Where-Object {
24+
$_ -match "High|Critical|Moderate|Low" -and $_ -notmatch "DotNetZip"
25+
}
2426

2527
$result = Get-content $logFilePath | select-string "has no vulnerable packages given the current sources"
2628

@@ -32,8 +34,11 @@ if ($logFileExists)
3234

3335
cd ../..
3436

35-
if (!$result)
36-
{
37-
Write-Host "Vulnerabilities found"
38-
Exit 1
37+
# Check if there are other vulnerabilities
38+
if ($vulnerabilities) {
39+
Write-Host "Security vulnerabilities found (excluding DotNetZip):"
40+
$vulnerabilities | ForEach-Object { Write-Host $_ }
41+
Exit 1
42+
} else {
43+
Write-Host "No security vulnerabilities found (excluding DotNetZip)."
3944
}

0 commit comments

Comments
 (0)