fix: reject empty/whitespace-only vulnerability_id in /v3/exploit-intelligence/analyze endpoint [Backport release/0.6.z] - #2571
Merged
Conversation
…elligence/analyze endpoint (cherry picked from commit 2b2a763)
Contributor
Reviewer's GuideThis PR backports validation for the /v3/exploit-intelligence/analyze endpoint so that empty or whitespace-only vulnerability_id values are rejected with a 400 Bad Request, and wires the new error type through the endpoint and runner layers with corresponding tests. Sequence diagram for analyze endpoint vulnerability_id validationsequenceDiagram
actor Client
participant AnalyzeEndpoint as analyze
participant ErrorType as Error
participant Http as HttpResponse
Client->>AnalyzeEndpoint: POST /v3/exploit-intelligence/analyze
AnalyzeEndpoint->>AnalyzeEndpoint: vulnerability_id.trim()
alt [vulnerability_id is empty]
AnalyzeEndpoint->>ErrorType: Error::BadRequest("vulnerability_id must not be empty")
ErrorType->>Http: ResponseError::error_response()
Http-->>Client: 400 BadRequest (ErrorInformation BadRequest)
else [vulnerability_id is non-empty]
AnalyzeEndpoint->>AnalyzeEndpoint: create_job(..., vulnerability_id, ...)
AnalyzeEndpoint-->>Client: 200 OK (AnalyzeResponse)
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:
- The
analyzehandler now trims and validatesvulnerability_idinline; consider extracting this into a small helper or validator so the same rule can be reused consistently if other endpoints accept avulnerability_id. - The
Error::BadRequestvariant currently takes aStringand is mapped toErrorInformation::new("BadRequest", msg); if you anticipate multiple BadRequest reasons, consider using a structured type or enum for the payload to distinguish causes more robustly than plain strings.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `analyze` handler now trims and validates `vulnerability_id` inline; consider extracting this into a small helper or validator so the same rule can be reused consistently if other endpoints accept a `vulnerability_id`.
- The `Error::BadRequest` variant currently takes a `String` and is mapped to `ErrorInformation::new("BadRequest", msg)`; if you anticipate multiple BadRequest reasons, consider using a structured type or enum for the payload to distinguish causes more robustly than plain strings.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Strum355
approved these changes
Aug 12, 2026
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 #2567 to
release/0.6.z.Summary by Sourcery
Validate vulnerability_id in the exploit intelligence analyze endpoint and treat invalid requests as permanent analysis errors.
Bug Fixes:
Tests: