-
-
Notifications
You must be signed in to change notification settings - Fork 49
feat: add cyclonedx.model.dependency.Dependency.provides
#735
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
Draft
uzairchhapra
wants to merge
10
commits into
CycloneDX:main
Choose a base branch
from
uzairchhapra:feat/691-uzair-provides
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fb4598d
feat: add `cyclonedx.model.dependency.Dependency.provides`
uzairchhapra 00536a7
chore(test): add unit test `test_dependency_with_provides`
uzairchhapra abf6abf
ft: update `validate` and `register_dependency` to read `provides`
uzairchhapra 8cdb39b
chore: set view schema to 1.6 for provides
uzairchhapra 2525660
chore(test): add test `get_bom_with_provides_valid`
uzairchhapra bd370af
fix: rename test to apply only for v1.6
uzairchhapra 5bdc59d
Merge remote-tracking branch 'upstream/main' into feat/691-uzair-prov…
uzairchhapra 7b64985
chore(test): add test `get_bom_with_provides`
uzairchhapra 3b4f790
chore(test): add snapshots for `get_bom_with_provides`
uzairchhapra 39a5f8f
chore(test): updated model `get_bom_with_provides`
uzairchhapra 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
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
113 changes: 113 additions & 0 deletions
113
tests/_data/snapshots/get_bom_v1_6_with_provides-1.6.json.bin
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,113 @@ | ||
{ | ||
"components": [ | ||
{ | ||
"bom-ref": "crypto-algorithm", | ||
"cryptoProperties": { | ||
"algorithmProperties": { | ||
"certificationLevel": [ | ||
"fips140-1-l1", | ||
"fips140-2-l3", | ||
"other" | ||
], | ||
"classicalSecurityLevel": 2, | ||
"cryptoFunctions": [ | ||
"sign", | ||
"unknown" | ||
], | ||
"curve": "9n8y2oxty3ao83n8qc2g2x3qcw4jt4wj", | ||
"executionEnvironment": "software-plain-ram", | ||
"implementationPlatform": "generic", | ||
"mode": "ecb", | ||
"nistQuantumSecurityLevel": 2, | ||
"padding": "pkcs7", | ||
"parameterSetIdentifier": "a-parameter-set-id", | ||
"primitive": "kem" | ||
}, | ||
"assetType": "algorithm", | ||
"oid": "an-oid-here" | ||
}, | ||
"name": "My Algorithm", | ||
"tags": [ | ||
"algorithm" | ||
], | ||
"type": "cryptographic-asset", | ||
"version": "1.0" | ||
}, | ||
{ | ||
"author": "Test Author", | ||
"bom-ref": "some-library", | ||
"licenses": [ | ||
{ | ||
"license": { | ||
"id": "MIT" | ||
} | ||
} | ||
], | ||
"name": "setuptools", | ||
"purl": "pkg:pypi/setuptools@50.3.2?extension=tar.gz", | ||
"type": "library", | ||
"version": "50.3.2" | ||
}, | ||
{ | ||
"bom-ref": "crypto-library", | ||
"externalReferences": [ | ||
{ | ||
"comment": "No comment", | ||
"hashes": [ | ||
{ | ||
"alg": "SHA-256", | ||
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b" | ||
} | ||
], | ||
"type": "distribution", | ||
"url": "https://cyclonedx.org" | ||
} | ||
], | ||
"hashes": [ | ||
{ | ||
"alg": "SHA-256", | ||
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b" | ||
} | ||
], | ||
"name": "toml", | ||
"purl": "pkg:pypi/toml@0.10.2?extension=tar.gz", | ||
"type": "library", | ||
"version": "0.10.2" | ||
} | ||
], | ||
"dependencies": [ | ||
{ | ||
"ref": "crypto-algorithm" | ||
}, | ||
{ | ||
"dependsOn": [ | ||
"some-library" | ||
], | ||
"provides": [ | ||
"crypto-algorithm" | ||
], | ||
"ref": "crypto-library" | ||
}, | ||
{ | ||
"ref": "some-library" | ||
} | ||
], | ||
"metadata": { | ||
"timestamp": "2023-01-07T13:44:32.312678+00:00" | ||
}, | ||
"properties": [ | ||
{ | ||
"name": "key1", | ||
"value": "val1" | ||
}, | ||
{ | ||
"name": "key2", | ||
"value": "val2" | ||
} | ||
], | ||
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac", | ||
"version": 1, | ||
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", | ||
"bomFormat": "CycloneDX", | ||
"specVersion": "1.6" | ||
} |
77 changes: 77 additions & 0 deletions
77
tests/_data/snapshots/get_bom_v1_6_with_provides-1.6.xml.bin
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,77 @@ | ||
<?xml version="1.0" ?> | ||
<bom xmlns="http://cyclonedx.org/schema/bom/1.6" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1"> | ||
<metadata> | ||
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp> | ||
</metadata> | ||
<components> | ||
<component type="cryptographic-asset" bom-ref="crypto-algorithm"> | ||
<name>My Algorithm</name> | ||
<version>1.0</version> | ||
<cryptoProperties> | ||
<assetType>algorithm</assetType> | ||
<algorithmProperties> | ||
<primitive>kem</primitive> | ||
<parameterSetIdentifier>a-parameter-set-id</parameterSetIdentifier> | ||
<curve>9n8y2oxty3ao83n8qc2g2x3qcw4jt4wj</curve> | ||
<executionEnvironment>software-plain-ram</executionEnvironment> | ||
<implementationPlatform>generic</implementationPlatform> | ||
<certificationLevel>fips140-1-l1</certificationLevel> | ||
<certificationLevel>fips140-2-l3</certificationLevel> | ||
<certificationLevel>other</certificationLevel> | ||
<mode>ecb</mode> | ||
<padding>pkcs7</padding> | ||
<cryptoFunctions> | ||
<cryptoFunction>sign</cryptoFunction> | ||
<cryptoFunction>unknown</cryptoFunction> | ||
</cryptoFunctions> | ||
<classicalSecurityLevel>2</classicalSecurityLevel> | ||
<nistQuantumSecurityLevel>2</nistQuantumSecurityLevel> | ||
</algorithmProperties> | ||
<oid>an-oid-here</oid> | ||
</cryptoProperties> | ||
<tags> | ||
<tag>algorithm</tag> | ||
</tags> | ||
</component> | ||
<component type="library" bom-ref="some-library"> | ||
<author>Test Author</author> | ||
<name>setuptools</name> | ||
<version>50.3.2</version> | ||
<licenses> | ||
<license> | ||
<id>MIT</id> | ||
</license> | ||
</licenses> | ||
<purl>pkg:pypi/setuptools@50.3.2?extension=tar.gz</purl> | ||
</component> | ||
<component type="library" bom-ref="crypto-library"> | ||
<name>toml</name> | ||
<version>0.10.2</version> | ||
<hashes> | ||
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash> | ||
</hashes> | ||
<purl>pkg:pypi/toml@0.10.2?extension=tar.gz</purl> | ||
<externalReferences> | ||
<reference type="distribution"> | ||
<url>https://cyclonedx.org</url> | ||
<comment>No comment</comment> | ||
<hashes> | ||
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash> | ||
</hashes> | ||
</reference> | ||
</externalReferences> | ||
</component> | ||
</components> | ||
<dependencies> | ||
<dependency ref="crypto-algorithm"/> | ||
<dependency ref="crypto-library"> | ||
<dependency ref="some-library"/> | ||
<provides ref="crypto-algorithm"/> | ||
</dependency> | ||
<dependency ref="some-library"/> | ||
</dependencies> | ||
<properties> | ||
<property name="key1">val1</property> | ||
<property name="key2">val2</property> | ||
</properties> | ||
</bom> |
Oops, something went wrong.
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.
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.
instead of adding a new parameter here, how about adding a new method instead:
register_provision(self, target: Dependable, provides: Optional[Iterable[Dependable]] = None)
.what do you think about this?
this would fit the original architectural plans better.
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'll give this a try
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.
@jkowalleck
How should this function work
register_provision
for the example mentioned pinmodels.py
?Considering
register_dependency
andregister_provision
will be called for all A, B and C, should I look for existing dependencies added inregister_provision
to avoid creating a new Dependency?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.
this is still open.
could you consider adding a new method?