-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(issueVariant): allow for creation of issue variant with only a severity rating #362
Changes from 3 commits
136ea54
1534754
1a1c42f
0f2bd86
8db5e0a
2a18a59
ad7dfb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
mutation ($input: IssueVariantInput!) { | ||
createIssueVariant ( | ||
input: $input | ||
) { | ||
id | ||
secondaryName | ||
description | ||
severity { | ||
value | ||
score | ||
} | ||
issueRepositoryId | ||
issueId | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ type Severity { | |
|
||
input SeverityInput { | ||
vector: String | ||
rating: SeverityValues | ||
} | ||
|
||
type FilterItem { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,30 @@ type Cursor struct { | |
Limit int | ||
} | ||
|
||
func NewSeverityFromRating(rating SeverityValues) Severity { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment where this values come from. There might also be an adjustment depending on the CVSS version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a comment about the CVSS specification with links, but I'm not sure how I would handle doing adjustments based on which CVSS specification since there is no information being passed other than the rating. Should I just do something else here instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now that's okay |
||
// These values are based on the CVSS v3.1 specification | ||
// https://www.first.org/cvss/v3.1/specification-document#Qualitative-Severity-Rating-Scale | ||
// https://nvd.nist.gov/vuln-metrics/cvss | ||
// They are the lower bounds of the CVSS Score ranges that correlate to each given Rating | ||
score := 0.0 | ||
switch rating { | ||
case SeverityValuesLow: | ||
score = 0.1 | ||
case SeverityValuesMedium: | ||
score = 4.0 | ||
case SeverityValuesHigh: | ||
score = 7.0 | ||
case SeverityValuesCritical: | ||
score = 9.0 | ||
} | ||
|
||
return Severity{ | ||
Value: string(rating), | ||
Score: score, | ||
Cvss: Cvss{}, | ||
} | ||
} | ||
|
||
func NewSeverity(url string) Severity { | ||
ev, err := metric.NewEnvironmental().Decode(url) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a vector is there, let's take the vector by default and simply overrule the "normal" severity.
@MR2011 @dorneanu WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated it now so that it just uses the vector and ignores the rating when both are passed.