Skip to content
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: prevent unknwon enums from rendering #496

Merged
merged 34 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
14f3cf9
tests: enum value range
jkowalleck Nov 28, 2023
fdc8c9d
tests: enum tidy
jkowalleck Nov 28, 2023
3b46f76
tests: enum Encoding
jkowalleck Nov 28, 2023
ae2a87a
tests: enums
jkowalleck Nov 28, 2023
878b846
tests: enums
jkowalleck Nov 28, 2023
8ebcdbe
tests: enums
jkowalleck Nov 28, 2023
68586ce
tests: enums
jkowalleck Nov 28, 2023
20d7a93
tests: enums
jkowalleck Nov 28, 2023
e5fcfa6
tests: enums
jkowalleck Nov 28, 2023
4791e49
tests: enums
jkowalleck Nov 28, 2023
989e240
tests: enums
jkowalleck Nov 28, 2023
b842293
tidy
jkowalleck Nov 28, 2023
9ee9676
add enum's `@serializable.serializable_enum`
jkowalleck Nov 29, 2023
024737f
enums filter: HashType
jkowalleck Nov 29, 2023
cf55379
tidy
jkowalleck Nov 29, 2023
0563167
tidy
jkowalleck Nov 29, 2023
e47afd4
tidy
jkowalleck Nov 29, 2023
a34bf69
tidy
jkowalleck Nov 29, 2023
2ce07a7
tidy
jkowalleck Nov 29, 2023
a64ebfc
bump py-serializable
jkowalleck Nov 29, 2023
117b547
enums migrate: ExternalReferenceType
jkowalleck Nov 29, 2023
1452e2a
enums migrate: ExternalReferenceType
jkowalleck Nov 29, 2023
63aca98
enum migrate: VulnerabilityScoreSource
jkowalleck Nov 29, 2023
97d3983
enum migrate: VulnerabilityScoreSource
jkowalleck Nov 29, 2023
1f7e6d3
enums migrate: ComponentScope
jkowalleck Nov 30, 2023
c0324d3
enums migrate: ComponentScope
jkowalleck Nov 30, 2023
ee3257f
tests: fix enum: DataFlow
jkowalleck Nov 30, 2023
932720e
more precise serialization errors
jkowalleck Nov 30, 2023
24cf9d0
handle CompnentType
jkowalleck Nov 30, 2023
da7ce56
test: raised on handle CompnentType
jkowalleck Nov 30, 2023
00497d6
tidy
jkowalleck Nov 30, 2023
0f83621
reprod
jkowalleck Nov 30, 2023
3661af8
cleanup
jkowalleck Nov 30, 2023
181f531
cleanup
jkowalleck Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cyclonedx/exception/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class NoPropertiesProvidedException(CycloneDxModelException):
"""
Raised when attempting to construct a model class and providing NO values (where all properites are defined as
Optional, but at least one is required).

"""
pass

Expand Down
50 changes: 50 additions & 0 deletions cyclonedx/exception/serialization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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.


"""
Exceptions relating to specific conditions that occur when (de)serializing/(de)normalizing CycloneDX BOM.
"""

from . import CycloneDxException


class CycloneDxSerializationException(CycloneDxException):
"""
Base exception that covers all exceptions that may be thrown during model serializing/normalizing.
"""
pass


class CycloneDxDeserializationException(CycloneDxException):
"""
Base exception that covers all exceptions that may be thrown during model deserializing/denormalizing.
"""
pass


class SerializationOfUnsupportedComponentTypeException(CycloneDxSerializationException):
"""
Raised when attempting serializing/normalizing a :py:class:`cyclonedx.model.component.Component`
to a :py:class:`cyclonedx.schema.schema.BaseSchemaVersion`
which does not support that :py:class:`cyclonedx.model.component.ComponentType`
.
"""


class SerializationOfUnexpectedValueException(CycloneDxSerializationException, ValueError):
"""
Raised when attempting serializing/normalizing a type that is not expected there.
"""
Loading