Skip to content

feat(proto,api,client): define ScanReport proto and add referrer persistence#1744

Merged
paralta merged 3 commits into
mainfrom
feat/scanner-proto
Jul 3, 2026
Merged

feat(proto,api,client): define ScanReport proto and add referrer persistence#1744
paralta merged 3 commits into
mainfrom
feat/scanner-proto

Conversation

@paralta

@paralta paralta commented Jul 3, 2026

Copy link
Copy Markdown
Member

This PR lays the foundation for treating security scan results as first-class Directory artifacts. It defines the ScanReport proto schema — covering scanner type, severity, findings, and analyzers — registers agntcy.dir.scan.v1.ScanReport as a referrer type constant, and wires up the full referrer lifecycle: MarshalReferrer/UnmarshalReferrer on the generated proto type and a PushScanReport method on the Dir client. Callers (importer, reconciler) can now persist scan results as OCI referrers after scanning without any further schema changes.

  • Severity includes an INFO level between NONE and LOW to accommodate scanner output that doesn't map cleanly to the traditional four-level scale.
  • PushScanReport returns an error rather than logging internally, leaving the caller in control of whether a storage failure should block the import gate — as required by the S4 spec.
  • The proto uses a plain string scanned_at instead of google.protobuf.Timestamp to avoid a Timestamp dependency in the generated api module.

Signed-off-by: Catarina Paralta <clouropa@cisco.com>
@paralta
paralta requested a review from a team as a code owner July 3, 2026 09:40
@github-actions github-actions Bot added the size/S Denotes a PR that changes 50-199 lines label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedJul 3, 2026, 1:54 PM

@paralta paralta changed the title feat(utils/scan): add ScanReport proto type and referrer feat(utils/scan): add ScanReport proto type and referrer Jul 3, 2026
@paralta paralta linked an issue Jul 3, 2026 that may be closed by this pull request
2 tasks
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.50000% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
client/scan.go 0.0% 13 Missing ⚠️
api/security/v1/scan_report.go 63.0% 5 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

Signed-off-by: Catarina Paralta <clouropa@cisco.com>
@github-actions github-actions Bot added size/M Denotes a PR that changes 200-999 lines and removed size/S Denotes a PR that changes 50-199 lines labels Jul 3, 2026
@paralta paralta changed the title feat(utils/scan): add ScanReport proto type and referrer feat(proto,api,client): define ScanReport proto and add referrer persistence Jul 3, 2026
@paralta paralta linked an issue Jul 3, 2026 that may be closed by this pull request
2 tasks
// ScanReport can be encoded into a RecordReferrer object as follows:
// type = "agntcy.dir.scan.v1.ScanReport"
// data = ScanReport message encoded as JSON
message ScanReport {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: consider adding annotations map here as clients may want to run their own scanners and attach extra details here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could we keep this under dir/security namespace or do you see adding other types of scan reports here?

@ramizpolic ramizpolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@paralta

paralta commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@ramizpolic Thanks for reviewing and for the feedback! will address both comments 👍

Signed-off-by: Catarina Paralta <clouropa@cisco.com>
@paralta
paralta merged commit bc3f17e into main Jul 3, 2026
33 checks passed
@paralta
paralta deleted the feat/scanner-proto branch July 3, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Persist scan results as referrer artifacts [Feature]: Define the scan result proto and referrer type

2 participants