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

Add SPDX 3.0 for example7 #85

Merged
merged 12 commits into from
Sep 26, 2024
Merged

Add SPDX 3.0 for example7 #85

merged 12 commits into from
Sep 26, 2024

Conversation

nishakm
Copy link
Collaborator

@nishakm nishakm commented Jun 10, 2024

No description provided.

@nishakm nishakm marked this pull request as draft June 10, 2024 13:43
@nishakm nishakm requested review from goneall and maxhbr June 10, 2024 13:43
@nishakm
Copy link
Collaborator Author

nishakm commented Jun 10, 2024

@JPEWdev @kzantow

@nishakm
Copy link
Collaborator Author

nishakm commented Jun 10, 2024

My questions:

  • Does xsd:anyURI mean a URI or a URN? If URN, is there a recommended way of generating these?
  • If we were generating URNs for every spdxId for every SPDX document, what happens when the same person generates a different URNs for the same thing?
  • How do we encode the license info in SPDX 2?
  • What dataLicense do we use for SPDX3?
  • How do we encode "document describes" relationship?
  • How do we encode "manual creation"?
  • Should the name of the document include the file extension? How do we manage the document naming during generation?

@maxhbr
Copy link
Member

maxhbr commented Jun 10, 2024

This is a draft but reviews are requested?

Copy link
Member

@maxhbr maxhbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rendered puml for the file (with the suggestions applied):

example7-golang spdx json

},
{
"spdxId": "https://golang.org/dl/go1.16.4.linux-amd64.tar.gz",
"type": "Software_Package",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"type": "Software_Package",
"type": "software_Package",

},
{
"spdxId": "https://golang.org/dl/go-compiler",
"type": "Software_File",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"type": "Software_File",
"type": "software_File",

"software"
],
"dataLicense": "CC0-1.0",
"createdUsing": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createdUsing seems to not be valid here. At least it trips the validator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...this file was created manually, not using any tool. How do we state that here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created using is a property of the creationInfo, not any element. It explains how the SPDX file was created.

@nishakm
Copy link
Collaborator Author

nishakm commented Jun 10, 2024

This is a draft but reviews are requested?

It's a first pass review to iron out the obvious mistakes. I'll convert it into an actual PR after I get feedback. Thanks a bunch!

@JPEWdev
Copy link
Contributor

JPEWdev commented Jun 10, 2024

#86 Will make it so that automatic validation is done on pull requests

@nishakm
Copy link
Collaborator Author

nishakm commented Jun 12, 2024

My questions:

* Does xsd:anyURI mean a URI or a URN? If URN, is there a recommended way of generating these?

You can make a URI with a UUID. If you don't own your own domain use: https://spdx.org/spdxdocs/-UUID
Or https://spdx.org/spdxdocs/UUID#SPDXId-

* If we were generating URNs for every spdxId for every SPDX document, what happens when the same person generates a different URNs for the same thing?

Referencing the same object that is referenced somewhere use and externalID. Don't worry about multiple UUIDs referencing the same thing.

Resolving the two different objects is fraught. They are in the end two different elements. Content identifiers can help but they are not the same thing. Equivalent but not equal.

* How do we encode the license info in SPDX 2?

Use SimpleLicensing > SimpleLicensingText

For Copyright text use Software > copyrightText

* What `dataLicense` do we use for SPDX3?

dataLicense is optional but CC0 is typically the one we use

* How do we encode "document describes" relationship?

You don't need it. The element list covers it.

Technically, the SpdxDocument.element should contain all SPDXIDs in the file except itself, but it is accepted that @graph is equivalent. This is not the case for any other container object.

* How do we encode "manual creation"?

Don't include this. If the document is not created by a tool there will be no Tool element in the CreationInfo.

* Should the name of the document include the file extension? How do we manage the document naming during generation?

The file name doesn't matter. Meanwhile, the files can have the .json file extension. Once parsing you can create a relationship SerializedInArtifact as a relationship.

"element": [
"urn:uuid:cf7dddac-8ce5-4a16-8860-ee255be7b4c8",
"urn:uuid:a9f18ff3-17fa-419d-8966-abe4b992312b",
"urn:uuid:d8bfb4bd-f3b9-4d5e-b83d-dd48038ecfde",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the comma

"comment": "The SBOM communicates that this document is an SBOM. The SBOM only has one element",
"rootElement": [
"urn:uuid:a9f18ff3-17fa-419d-8966-abe4b992312b"
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comma

]
"element": [
"urn:uuid:cf7dddac-8ce5-4a16-8860-ee255be7b4c8",
"urn:uuid:a9f18ff3-17fa-419d-8966-abe4b992312b",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, you probably meant:
"urn:uuid:e1877974-0aaa-48e6-931f-db4898c543f8"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2024-07-31 at 20 33 38

"creationInfo": "_:creationInfo",
"comment": "The SBOM communicates that this document is an SBOM. The SBOM only has one element",
"rootElement": [
"urn:uuid:a9f18ff3-17fa-419d-8966-abe4b992312b"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong spdxId. Assuming you intended to set the package spdxId, set:
"urn:uuid:e1877974-0aaa-48e6-931f-db4898c543f8"

@nishakm nishakm force-pushed the example7-spdx3 branch 2 times, most recently from 3cc3127 to dff9a0f Compare August 6, 2024 00:31
@nishakm nishakm marked this pull request as ready for review August 7, 2024 03:11
@nishakm nishakm changed the title WIP: Add SPDX 3.0 for example7 Add SPDX 3.0 for example7 Aug 7, 2024
@nishakm
Copy link
Collaborator Author

nishakm commented Aug 7, 2024

@JPEWdev @maxhbr @goneall @ilans This is ready for review.

Questions from me:

  • Although the person is the same, their SPDXID is different in each of the documents. I'm wondering if tools should strive to make this one SPDXID across all documents a person or organization should create or just generate UUIDs each time it executes?
  • I didn't see a "BUILD_TOOL_OF" equivalent in SPDX 3, so I made a stub "Build" element and expressed that relationship as inputs and outputs.

@nishakm nishakm force-pushed the example7-spdx3 branch 4 times, most recently from 67b1c05 to ff5b79b Compare August 7, 2024 17:58
@nishakm nishakm force-pushed the example7-spdx3 branch 3 times, most recently from 55065d2 to 9ccf7ad Compare August 8, 2024 15:42
@nishakm nishakm requested a review from maxhbr August 8, 2024 18:07
@nishakm
Copy link
Collaborator Author

nishakm commented Aug 9, 2024

@JPEWdev @maxhbr @goneall @ilans This is ready for review.

Note: the validator cannot validate ExternalMap elements yet. So I will need some manual review of example7-bin.spdx.json.

@kestewart
Copy link
Contributor

Pending validator fixes, this is expected to pass. Waiting for merge before rechecing.

@kestewart
Copy link
Contributor

@nishakm - can you rebase so the checks pass (merged in Josh's fix)

Signed-off-by: Nisha Kumar <[email protected]>
- Use URN instead of URI for spdxId
- Fix capitalization on types
- Move `createdUsing` to `CreationInfo` object

Signed-off-by: Nisha Kumar <[email protected]>
- Remove "createdUsing" as these files are manually created
- "rootElement" is a list
- "element" in the SBOM element is a list of all elements in the
  SBOM

Signed-off-by: Nisha Kumar <[email protected]>
Signed-off-by: Nisha Kumar <[email protected]>
- Remove Organization element
- Fix root element and element list uuids

Signed-off-by: Nisha Kumar <[email protected]>
Signed-off-by: Nisha Kumar <[email protected]>
- Add specVersion to creationInfo object
- Only one context allowed
- originatedBy is an array
- dataLicense is not required
- Fix element list in example7-third-party-modules.spdx.json
- Remove build conformance (requires more information about the build)

Signed-off-by: Nisha Kumar <[email protected]>
- Recalculate hashes for ExternalMap
- Remove Build element
- Update relationships
- Remove Build id from element list
- Move all ExternalMap elements to SpdxDocument "imports"

Signed-off-by: Nisha Kumar <[email protected]>
@nishakm
Copy link
Collaborator Author

nishakm commented Sep 25, 2024

@kestewart Done! Ready to merge

@goneall
Copy link
Member

goneall commented Sep 26, 2024

Thanks @nishakm - I'll go ahead and merge.

We may need to do some updates once we get the validation updated to 3.0.1, but we can take care of that after we update the validation.

@goneall goneall merged commit 6f8f8bf into spdx:master Sep 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants