-
Notifications
You must be signed in to change notification settings - Fork 184
Spdx 3.0 Parser for SBOM files #860
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9b96da3
Parsing spdx 3.0 with Unit tests and support for parsing with differe…
830788e
Fix unit test syntax issues, clean up json parser
5e5f17c
remove unnecessary changes, clean up assemblies
dadcb29
fix bugs in generator tests
bfca780
addressing pr comments
765b691
remove unused param
c4b0acb
make sure compliance standard has error handling and use enums
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
17 changes: 17 additions & 0 deletions
17
src/Microsoft.Sbom.Parsers.Spdx30SbomParser/Entities/Enums/ComplianceStandard.cs
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,17 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Sbom.Parsers.Spdx30SbomParser.Entities.Enums; | ||
|
|
||
| /// <summary> | ||
| /// Defines the different supported compliance standards. | ||
| /// </summary> | ||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum ComplianceStandard | ||
| { | ||
| NTIA, | ||
| None, | ||
| } |
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
33 changes: 33 additions & 0 deletions
33
src/Microsoft.Sbom.Parsers.Spdx30SbomParser/Entities/NTIAFile.cs
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,33 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Sbom.Parsers.Spdx30SbomParser.Entities; | ||
|
|
||
| /// <summary> | ||
| /// Refers to any object that stores content on a computer. | ||
| /// The type of content can optionally be provided in the contentType property. | ||
| /// https://spdx.github.io/spdx-spec/v3.0.1/model/Software/Classes/File/ | ||
| /// An NTIA file specifically describes a file compliant with the NTIA SBOM standard. | ||
| /// </summary> | ||
| public class NTIAFile : File | ||
| { | ||
| public NTIAFile() | ||
| { | ||
| Type = "software_File"; | ||
| } | ||
|
|
||
| [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
| [JsonPropertyName("software_contentType")] | ||
| public object ContentType { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Make verification code required for Files. This is an internal requirement, not a requirement from SPDX. | ||
| /// </summary> | ||
| [JsonRequired] | ||
| [JsonPropertyName("verifiedUsing")] | ||
| public override List<PackageVerificationCode> VerifiedUsing { get; set; } | ||
| } |
25 changes: 25 additions & 0 deletions
25
src/Microsoft.Sbom.Parsers.Spdx30SbomParser/Entities/NTIASpdxDocument.cs
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,25 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Text.Json.Serialization; | ||
| using Microsoft.Sbom.Parsers.Spdx30SbomParser.Entities.Enums; | ||
|
|
||
| namespace Microsoft.Sbom.Parsers.Spdx30SbomParser.Entities; | ||
|
|
||
| /// <summary> | ||
| /// The SpdxDocument provides a convenient way to express information about collections of SPDX Elements that could potentially be serialized as complete units (e.g., all in-scope SPDX data within a single JSON-LD file). | ||
| /// https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/SpdxDocument/ | ||
| /// An NTIA SpdxDocument specifically describes a SpdxDocument entity compliant with the NTIA SBOM standard. | ||
| /// </summary> | ||
| public class NTIASpdxDocument : SpdxDocument | ||
| { | ||
| public NTIASpdxDocument() | ||
| { | ||
| Type = nameof(SpdxDocument); | ||
| } | ||
|
|
||
| [JsonRequired] | ||
| [JsonPropertyName("name")] | ||
| public override string Name { get; set; } | ||
| } |
16 changes: 0 additions & 16 deletions
16
src/Microsoft.Sbom.Parsers.Spdx30SbomParser/Entities/NamespaceMap.cs
This file was deleted.
Oops, something went wrong.
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.