File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,11 +47,36 @@ jobs:
4747 $output = dotnet list ${{ env.SOLUTION_FILE }} package --vulnerable --include-transitive --format json --output-version 1 2>&1
4848 $text = ($output | Out-String).TrimEnd()
4949 $json = $text | ConvertFrom-Json
50+ $hasVulnerabilities = $false
5051
5152 foreach ($project in $json.projects) {
52- if ($project.frameworks) {
53- Write-Host 'Vulnerable package references were found.'
54- dotnet list ${{ env.SOLUTION_FILE }} package --vulnerable --include-transitive
55- exit 1
53+ if (-not $project.frameworks) {
54+ continue
5655 }
56+
57+ $isTestProject = $project.path -like '*/test/*'
58+
59+ foreach ($framework in $project.frameworks) {
60+ foreach ($package in $framework.topLevelPackages) {
61+ $hasVulnerabilities = $true
62+
63+ foreach ($vulnerability in $package.vulnerabilities) {
64+ Write-Host "$($project.path) ($($framework.framework)): top-level $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)"
65+ }
66+ }
67+
68+ if (-not $isTestProject) {
69+ foreach ($package in $framework.transitivePackages) {
70+ $hasVulnerabilities = $true
71+
72+ foreach ($vulnerability in $package.vulnerabilities) {
73+ Write-Host "$($project.path) ($($framework.framework)): transitive $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)"
74+ }
75+ }
76+ }
77+ }
78+ }
79+
80+ if ($hasVulnerabilities) {
81+ exit 1
5782 }
Original file line number Diff line number Diff line change 11<Project >
22 <PropertyGroup >
33 <NoWarn >$(NoWarn);SA0001;SA1101;SA1124;SA1200;SA1201;SA1208;SA1309;SA1310;SA1314;SA1401;SA1402;SA1413;SA1600;SA1629;SA1652;1591;CS8002;CA1018;CA1031;CA1063;CA1041;CA1802;CA1822;CA2211;CA2213;CA2235;CA2237;IDE1006;IDE0052;IDE0059;IDE0060;IDE0090;IDE0130;IDE0150;S4792;ASP0016;ASP0019</NoWarn >
4+ <NuGetAuditMode >direct</NuGetAuditMode >
45 </PropertyGroup >
56
67 <PropertyGroup >
You can’t perform that action at this time.
0 commit comments