Skip to content

[Bug]: Comprehensive Trivy findings are counted but never persisted to security_findings #73

Description

@Abhineshhh

Version

sbi version: main @ d9404ec
OS: N/A (code-path bug; no runtime required)
Go: 1.26.5

What happened?

When scanning with --comprehensive, Trivy secrets and misconfigurations are parsed into counts only (secrets_found / config_issues on the images row).

The security_findings table, domain.SecurityFinding type, and InsertImage insert path already exist, but nothing ever populates Image.SecurityFindings. Nightly runs use --comprehensive, so this data is silently dropped.

Expected: Individual secret/misconfiguration findings are stored in security_findings and available via QueryAllImageDetails / the detailed JSON report.

Steps to reproduce

  1. Inspect parseTrivyResult in pkg/infrastructure/scanner/trivy.go — only increments count fields.
  2. Inspect Analyze in analyzer.go — never assigns SecurityFindings.
  3. Run a comprehensive scan, then: SELECT COUNT(*) FROM security_findings; → always 0.

Relevant log output

No runtime error; findings are simply never written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions