Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Running self-validation produces a report containing the following information:

✓ SpdxTool_AddPackage - Passed
✓ SpdxTool_AddRelationship - Passed
SpdxTool_Validate - Passed
SpdxTool_Basic - Passed
✓ SpdxTool_CopyPackage - Passed
✓ SpdxTool_Diagram - Passed
✓ SpdxTool_FindPackage - Passed
Expand All @@ -126,7 +126,7 @@ Each test in the report proves a specific command works correctly:

- **SpdxTool_AddPackage** - `add-package` command adds a package with relationships to an SPDX file.
- **SpdxTool_AddRelationship** - `add-relationship` command adds a relationship between SPDX elements.
- **SpdxTool_Validate** - `validate` command accepts valid and rejects invalid SPDX files.
- **SpdxTool_Basic** - `validate` command accepts valid and rejects invalid SPDX files.
- **SpdxTool_CopyPackage** - `copy-package` command copies a package with relationships between SPDX files.
- **SpdxTool_Diagram** - `diagram` command generates a Mermaid diagram from an SPDX file.
- **SpdxTool_FindPackage** - `find-package` command locates a package by name in an SPDX file.
Expand Down
23 changes: 12 additions & 11 deletions docs/design/spdx-tool-targets/spdx-tool-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ The subsystem consists of two MSBuild `.targets` files:
- `buildMultiTargeting/DemaConsulting.SpdxTool.Targets.targets` — injected for
multi-TFM projects

Both files define the `DecorateNuGetSbom` target, which runs after the `Pack` target
Both files define the `DecorateSbomTarget` target, which runs after the `Pack` target
in the MSBuild pipeline.

### Workflow Invocation

The `DecorateNuGetSbom` target conditionally invokes `spdx-tool run-workflow` with
The `DecorateSbomTarget` target conditionally invokes `spdx-tool run-workflow` with
a user-supplied workflow file. The workflow file path is specified via the
`SpdxWorkflowFile` MSBuild property. The `spdx-tool` global tool must be installed
and available on the system `PATH`.
`SpdxWorkflowFile` MSBuild property. The `spdx-tool` command is configurable via the
`SpdxToolCommand` property (defaults to `dotnet spdx-tool`).
Comment thread
Malcolmnixon marked this conversation as resolved.

### Configuration Properties

| MSBuild Property | Default | Description |
|----------------------|---------|------------------------------------------------------|
| `DecorateSBOM` | `false` | Set to `true` to enable SBOM decoration during pack |
| `GenerateSBOM` | `true` | When `false`, skips decoration (no SBOM to decorate) |
| `SpdxWorkflowFile` | — | Path to the workflow YAML file for decoration |
| MSBuild Property | Default | Description |
|----------------------|----------------------|------------------------------------------------------|
| `DecorateSBOM` | `false` | Set to `true` to enable SBOM decoration during pack |
| `GenerateSBOM` | `true` | When `false`, skips decoration (no SBOM to decorate) |
| `SpdxWorkflowFile` | `spdx-workflow.yaml` | Path to the workflow YAML file for decoration |
| `SpdxToolCommand` | `dotnet spdx-tool` | Command used to invoke the spdx-tool |

## Conditional Execution

The `DecorateNuGetSbom` target is skipped when:
The `DecorateSbomTarget` target is skipped when:

- `DecorateSBOM` is not set to `true` (opt-in required)
- `GenerateSBOM` is `false` (no SBOM generated to decorate)
Expand All @@ -52,7 +53,7 @@ dotnet pack
Pack target completes (NuGet .nupkg + embedded SBOM generated)
DecorateNuGetSbom target
DecorateSbomTarget target
├─► Check DecorateSBOM == true (skip if false)
Expand Down
10 changes: 3 additions & 7 deletions docs/design/spdx-tool/self-test/validate-run-nuget-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ resolved from a NuGet package in the local NuGet cache and executed successfully
### Setup

1. Creates a `validate.tmp` working directory.
2. Writes an SPDX JSON document as a target for the NuGet workflow.
3. Writes a workflow YAML that uses the `nuget:` input to reference a known

NuGet package and a workflow file within it.
2. Writes a workflow YAML that uses the `nuget:` input to reference a known
NuGet package (`DemaConsulting.SpdxWorkflows`) and a workflow file within it
(`GetDotNetVersion.yaml`), capturing the output into a variable.

### Execution

Expand All @@ -23,7 +22,6 @@ Calls `Validate.RunSpdxTool("validate.tmp", ["--silent", "run-workflow", "workfl
### Verification

- The workflow must complete with exit code 0.
- The SPDX document must be updated as expected by the NuGet workflow.

### Teardown

Expand All @@ -32,13 +30,11 @@ Deletes the `validate.tmp` directory.
## Error Handling

- Returns `false` if `RunSpdxTool` returns a non-zero exit code.
- Returns `false` if the SPDX document is not updated as expected.
- The result is recorded in the `TestResults` collection as `Passed` or `Failed`.

## Constraints

- Requires internet or NuGet cache access to download/restore the NuGet package.
- The temporary directory is always deleted in a `finally` block.
- `PathHelpers.SafePathCombine` is used to prevent path traversal when resolving

the workflow file within the NuGet package.
8 changes: 4 additions & 4 deletions docs/reqstream/spdx-tool-targets/spdx-tool-targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sections:
sections:
- title: MSBuild Targets Integration
requirements:
- id: SpdxTool-Tgt-DecorateSbom
- id: SpdxTool-Target-DecorateSbom
title: The MSBuild targets package shall decorate SBOMs during dotnet pack.
tags:
- msbuild
Expand All @@ -22,7 +22,7 @@ sections:
- SingleTfmProject_DecorateSbomTrue_DecoratesSbom
- MultiTfmProject_DecorateSbomTrue_DecoratesSbom

- id: SpdxTool-Tgt-SkipDecorate
- id: SpdxTool-Target-SkipDecorate
title: The MSBuild targets package shall skip SBOM decoration when DecorateSBOM is false.
tags:
- msbuild
Expand All @@ -34,7 +34,7 @@ sections:
tests:
- SingleTfmProject_DecorateSbomFalse_SkipsDecoration

- id: SpdxTool-Tgt-SkipGenerateSbom
- id: SpdxTool-Target-SkipGenerateSbom
title: The MSBuild targets package shall skip SBOM decoration when GenerateSBOM is false.
tags:
- msbuild
Expand All @@ -46,7 +46,7 @@ sections:
tests:
- SingleTfmProject_GenerateSbomFalse_SkipsEntirely

- id: SpdxTool-Tgt-MissingWorkflowError
- id: SpdxTool-Target-MissingWorkflowError
title: The MSBuild targets package shall report a clear error when the workflow file is missing.
tags:
- msbuild
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/add-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: add-package Command
requirements:
- id: SpdxTool-Pkg-AddPackage
- id: SpdxTool-Package-AddPackage
title: The tool shall add packages to SPDX documents using the add-package command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/add-relationship.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: add-relationship Command
requirements:
- id: SpdxTool-Rel-AddRelationship
- id: SpdxTool-Relationship-AddRelationship
title: The tool shall add relationships to SPDX documents using the add-relationship command.
tags:
- spdx
Expand Down
36 changes: 18 additions & 18 deletions docs/reqstream/spdx-tool/commands/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ sections:
help system to enumerate available commands. The registry must correctly
map command names to their implementations.
children:
- SpdxTool-Pkg-AddPackage
- SpdxTool-Rel-AddRelationship
- SpdxTool-Pkg-CopyPackage
- SpdxTool-Xfm-Diagram
- SpdxTool-Pkg-FindPackage
- SpdxTool-Pkg-GetVersion
- SpdxTool-Hsh-Hash
- SpdxTool-Cmd-HelpCommand
- SpdxTool-Wkf-Print
- SpdxTool-Wkf-Query
- SpdxTool-Man-RenameId
- SpdxTool-Wkf-RunWorkflow
- SpdxTool-Wkf-NuGetWorkflow
- SpdxTool-Wkf-SetVariable
- SpdxTool-Xfm-ToMarkdown
- SpdxTool-Pkg-UpdatePackage
- SpdxTool-Val-Validate
- SpdxTool-Val-NtiaMinimum
- SpdxTool-Package-AddPackage
- SpdxTool-Relationship-AddRelationship
- SpdxTool-Package-CopyPackage
- SpdxTool-Transform-Diagram
- SpdxTool-Package-FindPackage
- SpdxTool-Package-GetVersion
- SpdxTool-Hash-Hash
- SpdxTool-Command-HelpCommand
- SpdxTool-Workflow-Print
- SpdxTool-Workflow-Query
- SpdxTool-Manage-RenameId
- SpdxTool-Workflow-RunWorkflow
- SpdxTool-Workflow-NuGetWorkflow
- SpdxTool-Workflow-SetVariable
- SpdxTool-Transform-ToMarkdown
- SpdxTool-Package-UpdatePackage
- SpdxTool-Validate-Validate
- SpdxTool-Validate-NtiaMinimum
tests:
- Command_Expand_NoVariables_ReturnsOriginal
- UnknownCommand_UnrecognizedCommand_ReportsError
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/copy-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: copy-package Command
requirements:
- id: SpdxTool-Pkg-CopyPackage
- id: SpdxTool-Package-CopyPackage
title: The tool shall copy packages between SPDX documents using the copy-package command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/diagram.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: diagram Command
requirements:
- id: SpdxTool-Xfm-Diagram
- id: SpdxTool-Transform-Diagram
title: The tool shall generate Mermaid diagrams from SPDX documents using the diagram command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/find-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: find-package Command
requirements:
- id: SpdxTool-Pkg-FindPackage
- id: SpdxTool-Package-FindPackage
title: The tool shall find packages in SPDX documents using the find-package command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/get-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: get-version Command
requirements:
- id: SpdxTool-Pkg-GetVersion
- id: SpdxTool-Package-GetVersion
title: The tool shall retrieve package versions from SPDX documents using the get-version command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/hash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: hash Command
requirements:
- id: SpdxTool-Hsh-Hash
- id: SpdxTool-Hash-Hash
title: The tool shall compute and verify file hashes using the hash command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/help.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: help Command
requirements:
- id: SpdxTool-Cmd-HelpCommand
- id: SpdxTool-Command-HelpCommand
title: The help command shall display extended usage information for a specified command.
tags:
- cli
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/print.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: print Command
requirements:
- id: SpdxTool-Wkf-Print
- id: SpdxTool-Workflow-Print
title: The tool shall support printing text within workflows using the print command.
tags:
- workflow
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: query Command
requirements:
- id: SpdxTool-Wkf-Query
- id: SpdxTool-Workflow-Query
title: The tool shall support querying external program output using the query command.
tags:
- workflow
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/rename-id.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: rename-id Command
requirements:
- id: SpdxTool-Man-RenameId
- id: SpdxTool-Manage-RenameId
title: The tool shall rename SPDX element IDs using the rename-id command.
tags:
- spdx
Expand Down
4 changes: 2 additions & 2 deletions docs/reqstream/spdx-tool/commands/run-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sections:
- title: run-workflow Command
requirements:
- id: SpdxTool-Wkf-RunWorkflow
- id: SpdxTool-Workflow-RunWorkflow
title: The tool shall execute workflow files using the run-workflow command.
tags:
- workflow
Expand All @@ -22,7 +22,7 @@ sections:
- RunWorkflow_WithOutputs_PopulatesOutputs
- RunWorkflow_UrlWorkflow_ExecutesWorkflow

- id: SpdxTool-Wkf-NuGetWorkflow
- id: SpdxTool-Workflow-NuGetWorkflow
title: The tool shall support running workflow files from NuGet packages using the run-workflow command.
tags:
- workflow
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/set-variable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: set-variable Command
requirements:
- id: SpdxTool-Wkf-SetVariable
- id: SpdxTool-Workflow-SetVariable
title: The tool shall support setting variables within workflows using the set-variable command.
tags:
- workflow
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/to-markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: to-markdown Command
requirements:
- id: SpdxTool-Xfm-ToMarkdown
- id: SpdxTool-Transform-ToMarkdown
title: The tool shall convert SPDX documents to Markdown format using the to-markdown command.
tags:
- spdx
Expand Down
2 changes: 1 addition & 1 deletion docs/reqstream/spdx-tool/commands/update-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sections:
- title: update-package Command
requirements:
- id: SpdxTool-Pkg-UpdatePackage
- id: SpdxTool-Package-UpdatePackage
title: The tool shall update existing packages in SPDX documents using the update-package command.
tags:
- spdx
Expand Down
4 changes: 2 additions & 2 deletions docs/reqstream/spdx-tool/commands/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
sections:
- title: validate Command
requirements:
- id: SpdxTool-Val-Validate
- id: SpdxTool-Validate-Validate
title: The tool shall validate SPDX documents using the validate command.
tags:
- spdx
Expand All @@ -18,7 +18,7 @@ sections:
- Validate_ValidSpdxDocument_Succeeds
- Validate_ValidDocumentNoFilesAnalyzed_Succeeds

- id: SpdxTool-Val-NtiaMinimum
- id: SpdxTool-Validate-NtiaMinimum
title: The tool shall validate SPDX documents against NTIA minimum elements requirements.
tags:
- spdx
Expand Down
Loading
Loading