-
-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Moved non‑standard implementations to Contrib area #916
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
Merged
+842
−338
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
f6430ec
feat: prepare "contrib" area
jkowalleck a8a4190
feat: prepare "contrib" area
jkowalleck 0e68f6e
feat: prepare "contrib" area
jkowalleck 3c2ad7d
feat: prepare "contrib" area
jkowalleck 3947eb7
feat: prepare "contrib" area
jkowalleck 885d47e
feat: prepare "contrib" area
jkowalleck bd37a9e
feat: prepare "contrib" area
jkowalleck 119690d
feat: prepare "contrib" area
jkowalleck 562049c
feat: prepare "contrib" area
jkowalleck ef83a07
feat: prepare "contrib" area
jkowalleck 7d14191
feat: prepare "contrib" area
jkowalleck b88d831
feat: prepare "contrib" area
jkowalleck 28b94a7
feat: prepare "contrib" area
jkowalleck 66d199c
feat: prepare "contrib" area
jkowalleck c1abdc3
feat: prep contrib
jkowalleck f8c43e6
feat: prepare "contrib" area
jkowalleck c0ca9bc
feat: prepare "contrib" area
jkowalleck be8d607
feat: prepare "contrib" area
jkowalleck 840fbd4
feat: prepare "contrib" area
jkowalleck f61abe9
feat: prepare "contrib" area
jkowalleck 5b98ab4
feat: prepare "contrib" area
jkowalleck 07c2a70
feat: prepare "contrib" area
jkowalleck 0e36aac
feat: prepare "contrib" area
jkowalleck bccb7e3
feat: prepare "contrib" area
jkowalleck ff0e11d
typos
jkowalleck 9436747
typos
jkowalleck 0d0443d
typos
jkowalleck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: prepare "contrib" area
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
- Loading branch information
commit be8d60734362bfc0f219dd1e1a9304f5cc0bd5ca
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # This file is part of CycloneDX Python Library | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright (c) OWASP Foundation. All Rights Reserved. | ||
|
|
||
| """Vulnerability related functionality""" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # This file is part of CycloneDX Python Library | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright (c) OWASP Foundation. All Rights Reserved. | ||
|
|
||
| """CVSS related utilities""" | ||
|
|
||
| __all__ = ['vs_from_cvss_scores'] | ||
|
|
||
| from typing import Union | ||
|
|
||
| from ...model.vulnerability import VulnerabilitySeverity | ||
|
|
||
|
|
||
| def vs_from_cvss_scores(scores: Union[tuple[float, ...], float, None]) -> VulnerabilitySeverity: | ||
| """ | ||
| Derives the Severity of a Vulnerability from it's declared CVSS scores. | ||
jkowalleck marked this conversation as resolved.
Show resolved
Hide resolved
jkowalleck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Args: | ||
| scores: A `tuple` of CVSS scores. CVSS scoring system allows for up to three separate scores. | ||
|
|
||
| Returns: | ||
| Always returns an instance of :class:`cyclonedx.model.vulnerability.VulnerabilitySeverity`. | ||
| """ | ||
| if type(scores) is float: | ||
| scores = (scores,) | ||
|
|
||
| if scores is None: | ||
| return VulnerabilitySeverity.UNKNOWN | ||
|
|
||
| max_cvss_score: float | ||
| if isinstance(scores, tuple): | ||
| max_cvss_score = max(scores) | ||
| else: | ||
| max_cvss_score = float(scores) | ||
|
|
||
| if max_cvss_score >= 9.0: | ||
| return VulnerabilitySeverity.CRITICAL | ||
| elif max_cvss_score >= 7.0: | ||
| return VulnerabilitySeverity.HIGH | ||
| elif max_cvss_score >= 4.0: | ||
| return VulnerabilitySeverity.MEDIUM | ||
| elif max_cvss_score > 0.0: | ||
| return VulnerabilitySeverity.LOW | ||
| else: | ||
| return VulnerabilitySeverity.NONE | ||
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.