Skip to content

Commit 09c50fe

Browse files
authored
Run cve-bin-tool (#2490)
1 parent 634d397 commit 09c50fe

File tree

2 files changed

+836
-0
lines changed

2 files changed

+836
-0
lines changed

scripts/azure-pipelines-cve.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
trigger: none
2+
3+
pr: none
4+
5+
parameters:
6+
- name: buildId
7+
displayName: 'The specific build ID to scan.'
8+
type: string
9+
default: 'latest'
10+
11+
resources:
12+
pipelines:
13+
- pipeline: SkiaSharp
14+
source: SkiaSharp
15+
trigger: none
16+
17+
pool:
18+
name: Azure Pipelines
19+
vmImage: ubuntu-20.04
20+
21+
steps:
22+
23+
- task: UsePythonVersion@0
24+
displayName: Switch to the correct Python version
25+
inputs:
26+
versionSpec: '3.x'
27+
architecture: 'x64'
28+
29+
- pwsh: pip install cve-bin-tool
30+
displayName: Install the CVE Binary Tool
31+
32+
- pwsh: cve-bin-tool --update now --nvd-api-key ${env:NVD_TOKEN}
33+
displayName: Update the database
34+
continueOnError: true
35+
36+
- template: azure-templates-download-artifacts.yml
37+
parameters:
38+
sourceBuildId: ${{ parameters.buildId }}
39+
artifacts:
40+
- name: nuget-signed
41+
42+
- pwsh: |
43+
foreach ($nupkg in (Get-ChildItem output/*.nupkg)) {
44+
$dest = "output/temp-nuget/$($nupkg.Name.TrimEnd('.nupkg'))"
45+
Write-Host "Extracting '$nupkg' to '$dest'..."
46+
Expand-Archive $nupkg $dest
47+
}
48+
New-Item output/logs -Type Directory -Force | Out-Null
49+
displayName: Extract all the packages
50+
51+
- pwsh: |
52+
cve-bin-tool output/temp-nuget --format html,console --output-file output/logs/report.html --triage-input-file scripts/guardian/cve-triage.json
53+
Get-Content output/logs/report.txt | Write-Host
54+
displayName: Run the CVE Binary Tool
55+
56+
- task: PublishPipelineArtifact@1
57+
displayName: Upload the final report
58+
condition: always()
59+
inputs:
60+
targetPath: output/logs
61+
publishLocation: 'pipeline'
62+
63+
- pwsh: |
64+
$content = (Get-Content output/logs/report.txt -Raw)
65+
$content = '```' + [Environment]::NewLine + $content + [Environment]::NewLine + '```'
66+
$content | Set-Content output/logs/report.txt
67+
Write-Host "##vso[task.uploadsummary]$(Build.SourcesDirectory)/output/logs/report.txt"
68+
displayName: Upload the build summary
69+
condition: always()

0 commit comments

Comments
 (0)