Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ class ExternalReferenceType(str, Enum):

.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.7/xml/#type_externalReferenceType

.. note::
``RFC_9116`` (for ``security.txt``, see RFC 9116) and ``RFC_9166`` are the same member.
``RFC_9166`` is a deprecated alias with a misspelled RFC number; use ``RFC_9116`` instead.
"""
# see `_ExternalReferenceSerializationHelper.__CASES` for view/case map
ADVERSARY_MODEL = 'adversary-model' # Only supported in >= 1.5
Expand Down Expand Up @@ -514,7 +518,8 @@ class ExternalReferenceType(str, Enum):
POAM = 'poam' # Only supported in >= 1.5
QUALITY_METRICS = 'quality-metrics' # Only supported in >= 1.5
RELEASE_NOTES = 'release-notes' # Only supported in >= 1.4
RFC_9166 = 'rfc-9116' # Only supported in >= 1.6
RFC_9116 = 'rfc-9116' # Only supported in >= 1.6
RFC_9166 = 'rfc-9116' # Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 # noqa: E501
RISK_ASSESSMENT = 'risk-assessment' # Only supported in >= 1.5
RUNTIME_ANALYSIS_REPORT = 'runtime-analysis-report' # Only supported in >= 1.5
SECURITY_CONTACT = 'security-contact' # Only supported in >= 1.5
Expand Down Expand Up @@ -586,7 +591,7 @@ class _ExternalReferenceSerializationHelper(serializable.helpers.BaseHelper):
ExternalReferenceType.SOURCE_DISTRIBUTION,
ExternalReferenceType.ELECTRONIC_SIGNATURE,
ExternalReferenceType.DIGITAL_SIGNATURE,
ExternalReferenceType.RFC_9166,
ExternalReferenceType.RFC_9116,
}
__CASES[SchemaVersion1Dot7] = __CASES[SchemaVersion1Dot6] | {
ExternalReferenceType.CITATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="rfc-9116">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="rfc-9116">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
8 changes: 8 additions & 0 deletions tests/test_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any,
])
super()._test_cases_render(bom, of, sv)

def test_rfc_9166_is_deprecated_alias_of_rfc_9116(self) -> None:
# see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074
self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType.RFC_9166)
self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116'))
self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType['RFC_9166'])
self.assertEqual('RFC_9116', ExternalReferenceType.RFC_9166.name)
self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9166.value)


@ddt
class TestEnumHashAlgorithm(_EnumTestCase):
Expand Down