fix(cvss): honor Exploit Maturity threat metric in CVSS v4.0 scoring [Backport release/0.6.z] - #2575
Merged
Merged
Conversation
(cherry picked from commit 155a5c9)
Use calculated_full_score() instead of calculated_base_score() for v4.0 so E:P/E:U are not stripped. No change for CVEs without an E metric. Implements TC-5626 Assisted-by: Claude Code (cherry picked from commit ca49359)
Add missing test for CVSS v4.0 with E:A (Attacked) exploit maturity metric as requested in PR review. Also fix variable name inconsistency where the local variable was renamed to full_score but still referenced cvss.full_score instead of cvss.base_score in the fallback. Addresses review feedback on PR #2569 Co-Authored-By: Claude Code <noreply@anthropic.com> (cherry picked from commit a837282)
Contributor
Reviewer's GuideBackport that fixes CVSS v4.0 scoring to honor Exploit Maturity (E) and enriches exploit-intelligence job/component accounting by correctly setting total_components and tightening assertions in tests and runner/service logic. Sequence diagram for updated CVSS v4.0 scoring using Exploit Maturity (sequence)sequenceDiagram
participant CvssV4 as CvssV4
participant ScoreInformation as ScoreInformation
CvssV4->>CvssV4: calculated_full_score()
alt full_score is Some
CvssV4-->>ScoreInformation: full_score
else full_score is None
CvssV4->>CvssV4: CvssV4::from_str(vector_string)
CvssV4->>CvssV4: calculated_full_score()
CvssV4-->>ScoreInformation: full_score_or_none
ScoreInformation->>ScoreInformation: unwrap_or(cvss.base_score)
end
ScoreInformation->>ScoreInformation: score = full_score as f32
ScoreInformation->>ScoreInformation: severity = (full_score, ScoreType::V4_0).into()
Sequence diagram for exploit-intelligence job completion/failure with total_components (sequence)sequenceDiagram
participant Runner as poll_for_product_result
participant EiService as ExploitIntelligenceService
participant DB as Database
Runner->>EiService: fetch_components(job_id, DB)
EiService-->>Runner: components
Runner->>Runner: [compute total = Some(components.len() as i32)]
alt has_finding or all_excluded
Runner->>EiService: update_job_completed(job_id, total, DB)
EiService->>DB: update exploit_intelligence_job (status=Completed, total_components)
DB-->>EiService: ok
EiService-->>Runner: ok
else no_findings and not_all_excluded
Runner->>EiService: update_job_failed(job_id, error_message, total, DB)
EiService->>DB: update exploit_intelligence_job (status=Failed, total_components)
DB-->>EiService: ok
EiService-->>Runner: ok
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
poll_for_resultthetotal_componentsis hard-coded toSome(1)when marking jobs completed; if this pipeline can ever handle more than one component, consider deriving the count fromfetch_componentsas you do inpoll_for_product_resultto keep summary metrics consistent. - The new
total_components: Option<i32>parameter onupdate_job_failedis only populated in some flows; review the various failure cases (e.g., product-level failures, timeout) to see if you can pass a meaningful component count where it is already known so that job summaries stay aligned across success and failure paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `poll_for_result` the `total_components` is hard-coded to `Some(1)` when marking jobs completed; if this pipeline can ever handle more than one component, consider deriving the count from `fetch_components` as you do in `poll_for_product_result` to keep summary metrics consistent.
- The new `total_components: Option<i32>` parameter on `update_job_failed` is only populated in some flows; review the various failure cases (e.g., product-level failures, timeout) to see if you can pass a meaningful component count where it is already known so that job summaries stay aligned across success and failure paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Resolved conflict in modules/exploit-intelligence/src/endpoints/test.rs by combining both changes: - Kept the updated field RFC3339 assertion from release/0.6.z - Kept the total_components assertion with JSON indexing syntax - Fixed comment for updated field assertion Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Backport of #2569 to
release/0.6.z.Summary by Sourcery
Adjust CVSS v4.0 scoring to honor the Exploit Maturity metric and persist total component counts in exploit-intelligence jobs for more accurate status reporting.
New Features:
Enhancements:
Tests: