Skip to content

Fix CVE-less SCA violations dropped under a Watch - #835

Draft
Jordanh1996 wants to merge 1 commit into
jfrog:devfrom
Jordanh1996:fix/cveless-sca-violations-dropped-under-watch
Draft

Fix CVE-less SCA violations dropped under a Watch#835
Jordanh1996 wants to merge 1 commit into
jfrog:devfrom
Jordanh1996:fix/cveless-sca-violations-dropped-under-watch

Conversation

@Jordanh1996

Copy link
Copy Markdown
Contributor

Problem

Any Xray SCA "Security" violation for a vulnerability that has no assigned CVE (only a native XRAY-XXXXX issue ID) is silently dropped when a Watch is used — with Frogbot V3 / jf audit --static-sca, the vulnerability never shows up in output, regardless of severity or policy match.

convertToCveViolations only builds output for entries in violation.Cves. Xray still returns a CveDetails entry for these vulnerabilities (CVSS/CWE populated), but with an empty cve field — which hits the cve.Id == "" guard and skips the violation entirely, with no fallback to the violation's own IssueId.

This is not a regression — the CVE-only assumption has been present since this converter was introduced (#543, 2025-11-23); CVE-less SCA vulnerabilities have never worked under a Watch.

Fix

Fall back to violation.IssueId when no Cves entry has a usable ID, mirroring the same fallback already used when building the SBOM (ExtractIssuesInfoForCdx) — so the pattern is already precedented elsewhere in this codebase, just not applied here.

Verification

Verified live against a real local Xray (not a unit test): a real Watch + Security policy (min severity Low) bound to a real indexed NuGet artifact carrying a real High-severity CVE-less vulnerability (XRAY-1034038, OpenTelemetry.Resources.Host).

Before this fix, calling the unmodified GenerateViolations against the real persisted violation:

[Info] Fetching violations from Xray...
[Warn] Skipping CVE violation with empty CVE ID for violation ID 2085062705793982464
=== SCA (CVE) violations returned: 0 ===

After the fix, same real Xray, same real violation:

=== SCA (CVE) violations returned: 1 ===

with correct severity (High), matched policy/watch, resolved impacted component, and fix version.

🤖 Generated with Claude Code

convertToCveViolations only converted entries in violation.Cves, and
Xray returns a CveDetails entry with an empty cve id (CVSS/CWE still
populated) for native XRAY-XXXXX vulnerabilities that have no assigned
CVE. Every such entry hit the empty-id guard and the whole violation
was dropped, regardless of severity or policy match.

Fall back to violation.IssueId when no Cves entry has a usable id,
mirroring the same fallback already used when building the SBOM
(ExtractIssuesInfoForCdx).

Verified live against a real local Xray: a real Watch + Security
policy bound to a real indexed NuGet artifact with a real High-severity
CVE-less vulnerability (XRAY-1034038, OpenTelemetry.Resources.Host).
Before this fix the violation was silently dropped; after, it is
returned with full severity/policy/component/fix-version data.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@attiasas attiasas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This will have the CLI shows violation that there are no vulnerabilities related to them that returned from the scan

i.e if you run the same scan without watches it will not show the XRAY-... vulnerabilities
until Catalog will also return those

FYI

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.

2 participants