-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
What it does?
Harbor has a Security Hub that tracks vulnerabilities across all scanned artifacts. The vulnerability command will allow users to view vulnerability data from the terminal.
It uses the go-client's Securityhub.ListVulnerabilities() and Securityhub.GetSecuritySummary() methods.
Proposed Approach
The following is a proposed structure for the command
-
Commands
| Command | What it does |
|---|---|
harbor vulnerability summary |
Retrieve the vulnerability summary of the system |
harbor vulnerability list |
Lists individual vulnerabilities |
-
summarycommand and its flags
Shows a vulnerability overview across all artifacts.
| Flag | Description |
|---|---|
--with-dangerous-artifact |
Include top 5 most dangerous artifacts |
--with-dangerous-cve |
Include top 5 most dangerous CVEs |
-
summarycommand CLI output
The following output will appear when both flags are used. I am also experimenting with making the progress bar colorful.
$ harbor vuln summary --with-dangerous-artifact --with-dangerous-cve
2 artifact(s), 2 scanned, 0 not scanned
Total Vulnerabilities: 360 (Fixable: 281)
Critical ███░░░░░░░░░░░░░░░░░░░░░░░░░░░ 40
High ██████████░░░░░░░░░░░░░░░░░░░░ 125
Medium █████████████░░░░░░░░░░░░░░░░░ 161
Low ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 25
Unknown █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 9
None ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0
Top 5 Most Dangerous Artifacts
┌──────────────────────────────────────────────────────────────────────────────────────┐
│ Project… Repository Digest Critical High Medium │
│ ──────────────────────────────────────────────────────────────────────────────────── │
│ 8 library/nginx sha256:8269a7352 39 125 161 │
│ . . . . . . |
│ . . . . . . │
└──────────────────────────────────────────────────────────────────────────────────────┘
Top 5 Most Dangerous CVEs
┌────────────────────────────────────────────────────────────────────┐
│ CVE ID Severity CVSS3 Package Version │
│ ────────────────────────────────────────────────────────────────── │
│ CVE-2022-37434 Critical 9.8 zlib1g 1:1.2.1 │
│ . . . . . │
│ . . . . . │
│ . . . . . │
│ . . . . . │
└────────────────────────────────────────────────────────────────────┘
-
listcommand flags
Lists individual vulnerabilities with filtering and pagination.
Pagination & output:
| Flag | Default | Description |
|---|---|---|
--page |
1 | Page number |
--page-size |
10 | Results per page |
--tune-count |
false | Ignore total count when > 1000 |
--with-tag |
false | Include tag info in results |
--detail |
false | Show full details (needs --cve-id) |
-q / --query |
Raw Security Hub query string |
Filter flags :
| Flag | Description |
|---|---|
--cve-id |
Filter by CVE ID |
--severity |
Filter by severity |
--repository-name |
Filter by repository |
--project-id |
Filter by project ID |
--package |
Filter by package name |
--tag |
Filter by artifact tag |
--digest |
Filter by digest |
--cvss-score-v3-range |
CVSS v3 range, e.g. 7.0~10.0 |
-
listcommand CLI oytput
Default list view:
$ harbor vuln list
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project… Repository Digest CVE ID Severity CVSS V3 Package Version Fixed │
│ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ 8 library/nginx sha256:8269a7352 CVE-2022-22822 Critical 9.8 libexpat1 2.2.6-2 2.2.6-2 │
│ . . . . . . . . . │
│ . . . . . . . . . │
│ . . . . . . . . . │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Detail view (--cve-id + --detail):
$ harbor vuln list --cve-id CVE-2022-23219 --detail
VULNERABILITY 1
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Attribute Value │
│ ──────────────────────────────────────────────────────────────────────────────────────────────── │
│ CVE ID CVE-2022-23219 │
│ Severity Critical │
│ CVSS V3 9.8 │
│ Project ID 8 │
│ Repository library/nginx │
│ Tag - │
│ Digest sha256:8269a7352a7dad1f8b3dc83284f195bac72027dd50279422d363… │
│ Package libc-bin │
│ Version 2.28-10 │
│ Fixed Version 2.28-10+deb10u2 │
│ Description The deprecated compatibility function clnt_create in the su.. │
│ Links https://avd.aquasec.com/nvd/cve-2022-23219 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
Please have a look and suggest any required changes in the structure of the command.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels