Skip to content

Add "Status" field to Vulnerability in the scan report#28

Merged
reasonerjt merged 1 commit intogoharbor:mainfrom
reasonerjt:support-vuln-status
Jul 16, 2025
Merged

Add "Status" field to Vulnerability in the scan report#28
reasonerjt merged 1 commit intogoharbor:mainfrom
reasonerjt:support-vuln-status

Conversation

@reasonerjt
Copy link
Copy Markdown

This commit is part of fix of the issue in Harbor: goharbor/harbor#21445
It addes the "Status" field into vulnerabilities of a scan report, so that this information can be passed to "harbor-core"

@reasonerjt reasonerjt requested a review from Copilot July 14, 2025 07:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Status field to the vulnerability data models and propagates it through the transformer logic and tests.

  • Adds a Status property to the Trivy vulnerability model
  • Maps the new Status field in the scan transformer and updates Harbor’s model
  • Extends existing transformer tests to assert on the Status values

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/trivy/model.go Added Status field to Vulnerability struct
pkg/scan/transformer.go Populates the new Status field when converting to Harbor model
pkg/scan/transformer_test.go Updated test cases to include expected Status values
pkg/harbor/model.go Added Status field to VulnerabilityItem with JSON tag

VulnerabilityID string `json:"VulnerabilityID"`
PkgName string `json:"PkgName"`
InstalledVersion string `json:"InstalledVersion"`
Status string `json:"Status"`
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider defining constants for the valid status values (e.g., "fixed", "won't fix") and using them here and in tests to avoid scattering magic strings.

Suggested change
Status string `json:"Status"`
Status string `json:"Status"` // Use constants like StatusFixed, StatusWontFix, etc.

Copilot uses AI. Check for mistakes.
This commit is part of fix of the issue in Harbor:
goharbor/harbor#21445
It addes the "Status" field into vulnerabilities of a scan report,
so that this information can be passed to "harbor-core"

Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com>
@reasonerjt reasonerjt force-pushed the support-vuln-status branch from 45f9252 to 0b40032 Compare July 14, 2025 08:05
@reasonerjt reasonerjt merged commit b35136d into goharbor:main Jul 16, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants