-
-
Notifications
You must be signed in to change notification settings - Fork 47
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: add cyclonedx.model.crypto.ProtocolProperties.crypto_refs
#767
Conversation
300ad09
to
59f49cc
Compare
cyclonedx.model.crypto.ProtocolProperties.crypto_ref_array
Thanks for donating this feature. The provided tests - they need rework. please remove the ones you've added. Instead, add a new data model to https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/tests/_data/models.py
after that, the tests should pick up the new method automatically, and run a serialization-validation-deserialization roundtrip with it and create snapshots. |
59f49cc
to
2be5db0
Compare
I'll clean up the commit message and squash as well with signoff I needed some direction/feedback on how to resolve issues i am facing in tests (if i added them correctly) in 2be5db0, commit message has been documented with issues i faced |
That's fantastic. Somehow, the sign-off was not quite right. |
It looks like you are facing the situation, that your data model's properties are not properly serializing to a certain version of CycloneDX.
in case you still run into issue, for example a enum value that is available in one vetrsion, but not in the pother, let me know. it basically comes down to something like this cyclonedx-python-lib/cyclonedx/model/component.py Lines 376 to 428 in 472bded
|
I saw thos but couldn't figure out the fix :')
for second issue the test failure seems to valid given the dictionary mapping currently __CASES: Dict[Type[serializable.ViewType], FrozenSet[ComponentType]] = dict()
__CASES[SchemaVersion1Dot0] = frozenset({
ComponentType.APPLICATION,
ComponentType.DEVICE,
ComponentType.FRAMEWORK,
ComponentType.LIBRARY,
ComponentType.OPERATING_SYSTEM,
})
__CASES[SchemaVersion1Dot1] = __CASES[SchemaVersion1Dot0] | {
ComponentType.FILE,
}
__CASES[SchemaVersion1Dot2] = __CASES[SchemaVersion1Dot1] | {
ComponentType.CONTAINER,
ComponentType.FIRMWARE,
}
__CASES[SchemaVersion1Dot3] = __CASES[SchemaVersion1Dot2]
__CASES[SchemaVersion1Dot4] = __CASES[SchemaVersion1Dot3]
__CASES[SchemaVersion1Dot5] = __CASES[SchemaVersion1Dot4] | {
ComponentType.DATA,
ComponentType.DEVICE_DRIVER,
ComponentType.MACHINE_LEARNING_MODEL,
ComponentType.PLATFORM,
}
__CASES[SchemaVersion1Dot6] = __CASES[SchemaVersion1Dot5] | {
ComponentType.CRYPTOGRAPHIC_ASSET,
} so cryptographi-asset is not supported for any version < v1.6, so how to do i restrict tests not be generated from all v1.6? e.g. error err log : |
Will take a look at it sometime next week. |
b85dd98
to
3583283
Compare
I have squashed and rebased the PR with latest upstream main |
3583283
to
21f8900
Compare
@indiVar0508 , could you add the test snapshots? see here for instructions: https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/tests/_data/snapshots/README.md |
applied the fix recommended in the thread, to add crypto_ref_array as an argument to ProtocolProperties class Also updated bom1.6.SNAPSHOT.xsd from cryptoRef -> cryptoRefArray added testcase and BOM json from the mentioned issue. Signed-off-by: Indivar Mishra <indimishra@gmail.com>
resolve review comments Signed-off-by: Indivar Mishra <indimishra@gmail.com>
so use applciation instead that is supported from v1.0 - v1.6 Signed-off-by: Indivar Mishra <indimishra@gmail.com>
Hi @jkowalleck , v1.6 one seems to be failing saying file doesn't exist but file is created as seen in file diff, not sure why it is failing |
of cause new snapshots do not exist for comparison when they are not provided, so some tests might fail when run the first time. |
----------------------------------------------------------------------
Ran 5257 tests in 7.352s
FAILED (failures=2)
py: exit 1 (8.33 seconds) /home/indivar/github/cyclonedx-python-lib> poetry run coverage run --source=cyclonedx -m unittest discover -t . -s tests -v pid=2814
py: FAIL code 1 (9.67=setup[0.03]+cmd[0.00,0.73,0.58,8.33] seconds)
evaluation failed :( (9.72 seconds) one of the value seems to be come None, for same two tests test failed names
|
try to set a bom-ref for |
21f8900
to
241f29d
Compare
Signed-off-by: Indivar Mishra <indimishra@gmail.com>
241f29d
to
465cd3a
Compare
Thanks for guiding me, yeah this worked Although want to mention two things
Please let me know if any other change is required ✨ |
could you commit the new test snapshot files? |
Signed-off-by: Indivar Mishra <indimishra@gmail.com>
cyclonedx.model.crypto.ProtocolProperties.crypto_ref_array
cyclonedx.model.crypto.ProtocolProperties.crypto_refs
followup of #767 Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
applied the fix recommended in the thread.
added testcase and BOM json from the mentioned issue.
fixes #692