Support CI generation of SBOMs via golang tooling.

Overview

SPDX Software Bill of Materials (SBOM) Generator

Overview

Software Package Data Exchange (SPDX) is an open standard for communicating software bill of materials (SBOM) information that supports accurate identification of software components, explicit mapping of relationships between components, and the association of security and licensing information with each component.

spdx-sbom-generatortool to help those in the community that want to generate SPDX Software Bill of Materials (SBOMs) with current package managers. It has a command line Interface (CLI) that lets you generate SBOM information, including components, licenses, copyrights, and security references of your software using SPDX v2.2 specification and aligning with the current known minimum elements from NTIA. It automatically determines which package managers or build systems are actually being used by the software.

spdx-sbom-generatoris supporting the following package managers:

  • GoMod (go)
  • Cargo (Rust)
  • Composer (PHP)
  • DotNet (.NET)
  • Maven (Java)
  • NPM (Node.js)
  • Yarn (Node.js)
  • PIP (Python)
  • Pipenv (Python)
  • Gems (Ruby)
  • Swift Package Manager (Swift)

Installation

You can download the following binaries and copy paste the application or binary in your cloned project on your local to generate the SPDX SBOM file. You need to execute the following in the command line tool:

./spdx-sbom-generator

The following binaries are available to download for various operating system:

On Windows, you can also download and install the appropriate binary with Scoop: scoop install spdx-sbom-generator.

Note: The spdx-sbom-generator CLI is under development. You may expect some breakages and stability issues with the current release. A stable version is under development and will be available to the open source community in the upcoming beta release.

Available command Options

Use the below command to view different options or flags related to SPDX SBOM generator:

./spdx-sbom-generator -h

The following different commands are listed when you use the help in the SPDX SBOM generator:

./spdx-sbom-generator -h

Output Package Manager dependency on SPDX format

Usage:
  spdx-sbom-generator [flags]

Flags:
  -h, --help                   help for spdx-sbom-generator
  -i, --include-license-text   include full license text (default: false)
  -o, --output-dir string      directory to write output file to (default: current directory)
  -p, --path string            the path to package file or the path to a directory which will be recursively analyzed for the package files (default '.') (default ".")
  -s, --schema string          <version> Target schema version (default: '2.2') (default "2.2")
  -f, --format string          output file format (default: 'spdx')

Output Options

The following list supports various formats in which you can generate the SPDX SBOM file:

  • spdx (Default format)

  • JSON

  • RDF (In progress)

Use the below command to generate the SPDX SBOM file in SPDX format:

./spdx-sbom-generator -o /out/spdx/

Output Sample

The following snippet is a sample SPDX SBOM file:

SPDXVersion: SPDX-2.2
DataLicense: CC0-1.0
SPDXID: SPDXRef-DOCUMENT
DocumentName: spdx-sbom-generator
DocumentNamespace: http://spdx.org/spdxpackages/spdx-sbom-generator--57918521-3212-4369-a8ed-3d681ec1d7a1
Creator: Tool: spdx-sbom-generator-XXXXX
Created: 2021-05-23 11:25:29.1672276 -0400 -04 m=+0.538283001

##### Package representing the Go distribution

PackageName: go
SPDXID: SPDXRef-Package-go
PackageVersion: v0.46.3
PackageSupplier: NOASSERTION
PackageDownloadLocation: pkg:golang/cloud.google.com/[email protected]
FilesAnalyzed: false
PackageChecksum: TEST: SHA-1 224ffa55932c22cef869e85aa33e2ada43f0fb8d
PackageHomePage: pkg:golang/cloud.google.com/[email protected]
PackageLicenseConcluded: NOASSERTION
PackageLicenseDeclared: NOASSERTION
PackageCopyrightText: NOASSERTION
PackageLicenseComments: NOASSERTION
PackageComment: NOASSERTION

Relationship: SPDXRef-DOCUMENT DESCRIBES SPDXRef-Package-go

##### Package representing the Bigquery Distribution

PackageName: bigquery
SPDXID: SPDXRef-Package-bigquery
PackageVersion: v1.0.1
PackageSupplier: NOASSERTION
PackageDownloadLocation: pkg:golang/cloud.google.com/go/[email protected]
FilesAnalyzed: false
PackageChecksum: TEST: SHA-1 8168e852b675afc9a63b502feeefac90944a5a2a
PackageHomePage: pkg:golang/cloud.google.com/go/[email protected]
PackageLicenseConcluded: NOASSERTION
PackageLicenseDeclared: NOASSERTION
PackageCopyrightText: NOASSERTION
PackageLicenseComments: NOASSERTION
PackageComment: NOASSERTION

Relationship: SPDXRef-Package-go CONTAINS SPDXRef-Package-bigquery

Docker Images

You can run this program using a Docker image that contains spdx-sbom-generator. To do this, first install Docker.

You’ll then need to pull (download) a Docker image that contains the program. An easy way is to run docker pull spdx/spdx-sbom-generator

spdx-sbom-generator: this is an Alpine image with the spdx-sbom-generator binary installed. You can re-run the pull command to update the image.

Finally, run the program, using this form

$ docker run -it --rm \
    -v "/path/to/repository:/repository" \
    -v "$(pwd)/out:/out" \
    spdx/spdx-sbom-generator -p /repository/ -o /out/

Architecture

General Architecture

Data Contract

The interface requires the following functions:

type IPlugin interface {
  SetRootModule(path string) error
  GetVersion() (string, error)
  GetMetadata() PluginMetadata
  GetRootModule(path string) (*Module, error)
  ListUsedModules(path string) ([]Module, error)
  ListModulesWithDeps(path string) ([]Module, error)
  IsValid(path string) bool

Module model definition:

type Module struct {
  Version          string `json:"Version,omitempty"`
  Name             string
  Path             string `json:"Path,omitempty"`
  LocalPath        string `json:"Dir,noempty"`
  Supplier         SupplierContact
  PackageURL       string
  CheckSum         *CheckSum
  PackageHomePage  string
  LicenseConcluded string
  LicenseDeclared  string
  CommentsLicense  string
  OtherLicense     []*License
  Copyright        string
  PackageComment   string
  Root             bool
  Modules          map[string]*Module
}

PluginMetadata model definition:

type PluginMetadata struct {
    Name       string
    Slug       string
    Manifest   []string
    ModulePath []string
}

How to Generate Module Values

  • CheckSum: We have built an internal method that calculates CheckSum for a given content (in bytes) using algorithm that is defined on models.CheckSum. You now have an option to provide Content field for models.CheckSum{} and CheckSum will calculate automatically, but if you want to calculate CheckSum on your own you still can provide Value field for models.CheckSum{}.

Also, you can generate a manifest from a given directory tree using utility/helper method BuildManifestContent, and that is what is used for gomod plugin as Content value.

Interface Definitions

The following list provides the interface definitions:

  • GetVersion: Returns version of current project platform (development language) version i.e: go version

    Input: None

    Output: Version in string format and error (null in case of successful process)

  • GetMetadata: Returns metadata of identify ecosystem pluging

    Input: None

    Output: Plugin metadata

PluginMetadata{
    Name:       "Go Modules",
    Slug:       "go-mod",
    Manifest:   []string{"go.mod"},
    ModulePath: []string{"vendor"},
}
  • SetRootModule: Sets root package information base on path given

    Input: The working directory to read the package from

    Output: Returns error

  • GetRootModule: Returns root package information base on path given

    Input: The working directory to read the package from

    Output: Returns the Package Information of the root Module

  • ListUsedModules: Fetches and lists all packages required by the project in the given project directory, this is a plain list of all used modules (no nested or tree view)

    Input: The working directory to read the package from

    Output: Returns the Package Information of the root Module, and its dependencies in flatten format

  • ListModulesWithDeps: Fetches and lists all packages (root and direct dependencies) required by the project in the given project directory (side-by-side), this is a one level only list of all used modules, and each with its direct dependency only (similar output to ListUsedModules but with direct dependency only)

    Input: The working directory to read the package from

    Output: Returns the Package Information of the root Module, and its direct dependencies

  • IsValid: Check if the project dependency file provided in the contract exists

    Input: The working directory to read the package from

    Output: True or False

  • HasModulesInstalled: Check whether the current project(based on given path) has the dependent packages installed

    Input: The working directory to read the package from

    Output: True or False

Module Structure JSON Example

The sample module structure JSON Code snippet is provided in the following code snippet:

{
       "Version": "v0.0.1-2019.2.3",
       "Name": "honnef.co/go/tools",
       "Path": "honnef.co/go/tools",
       "LocalPath": "",
       "Supplier": {
               "Type": "",
               "Name": "",
               "EMail": ""
       },
       "PackageURL": "pkg:golang/honnef.co/go/[email protected]",
       "CheckSum": {
               "Algorithm": "SHA-1",
               "Value": "66ed272162df8ef5f9e6d7bece3da6828a4ef3eb"
       },
       "PackageHomePage": "",
       "LicenseConcluded": "",
       "LicenseDeclared": "",
       "CommentsLicense": "",
       "OtherLicense": null,
       "Copyright": "",
       "PackageComment": "",
       "Root": false,
       "Modules": {
               "github.com/BurntSushi/toml": {
                       "Version": "v0.3.1",
                       "Name": "github.com/BurntSushi/toml",
                       "Path": "github.com/BurntSushi/toml",
                       "LocalPath": "",
                       "Supplier": {
                               "Type": "",
                               "Name": "",
                               "EMail": ""
                       },
                       "PackageURL": "pkg:golang/github.com/BurntSushi/[email protected]",
                       "CheckSum": {
                               "Algorithm": "SHA-1",
                               "Value": "38263d2f264e90324c9e9b3b1933f0e94fde1c7e"
                       },
                       "PackageHomePage": "",
                       "LicenseConcluded": "",
                       "LicenseDeclared": "",
                       "CommentsLicense": "",
                       "OtherLicense": null,
                       "Copyright": "",
                       "PackageComment": "",
                       "Root": false,
                       "Modules": null
               }
        }
}

For a more complete JSON example look at modules.json.

Utility Methods

The following list provide the utility methods:

  • BuildManifestContent : Walks through a given directory tree, and generates a content based on file paths

    Input: Directory to walk through

    Output: Directory tree in bytes

  • GetLicenses: Returns the detected license object

    Input: The working directory of the package licenses

    Output: The package license object

type License struct {
	ID            string
	Name          string
	ExtractedText string
	Comments      string
	File          string
}
  • LicenseSPDXExists: Check if the package license is a valid SPDX reference

    Input: The package license

    Output: True or False

How to Register a New Plugin

To register for a new plugin, perform the following steps:

  1. Clone a project.

    git clone [email protected]:LF-Engineering/spdx-sbom-generator.git
    
  2. Create a new directory into ./pkg/modules/ with package manager name, for example: npm, you should end with a directory:

    /pkg/modules/npm
    
    
  3. Create a Handler file, for example: handler.go, and follow Data Contract section above. Define package name, and import section as explained in the following code snippet:

    package npm
    
    import (
    	"path/filepath"
    
    	"github.com/spdx/spdx-sbom-generator/pkg/helper"
    	"github.com/spdx/spdx-sbom-generator/pkg/models"
    )
    
    // rest of the file below
    
    
  4. In handler.go, define the plugin struct with at least the plugin metadata info as explained in the following code snippet:

    type npm struct {
    	metadata models.PluginMetadata
    }
    
    
  5. Define plugin registration method (New func) with metadata values as explained in the following code snippet:

    // New ...
    func New() *npm {
    	return &npm{
    		metadata: models.PluginMetadata{
    			Name:       "Node Package Manager",
    			Slug:       "npm",
    			Manifest:   []string{"package.json"},
    			ModulePath: []string{"node_modules"},
    		},
    	}
    }
    
    
  6. In handler.go, create the required interface function (Data contract definition above).

    // GetMetadata ...
    func (m *npm) GetMetadata() models.PluginMetadata {
      return m.metadata
    }
    
    // IsValid ...
    func (m *npm) IsValid(path string) bool {
      for i := range m.metadata.Manifest {
        if helper.Exists(filepath.Join(path, m.metadata.Manifest[i])) {
          return true
        }
      }
      return false
    }
    
    // HasModulesInstalled ...
    func (m *npm) HasModulesInstalled(path string) error {
      for i := range m.metadata.ModulePath {
        if helper.Exists(filepath.Join(path, m.metadata.ModulePath[i])) {
          return nil
        }
      }
      return errDependenciesNotFound
    }
    
    // GetVersion ...
    func (m *npm) GetVersion() (string, error) {
      output, err := exec.Command("npm", "--version").Output()
      if err != nil {
        return "", err
      }
    
      return string(output), nil
    }
    
    // SetRootModule ...
    func (m *npm) SetRootModule(path string) error {
      return nil
    }
    
    // GetRootModule ...
    func (m *npm) GetRootModule(path string) (*models.Module, error) {
      return nil, nil
    }
    
    // ListUsedModules...
    func (m *npm) ListUsedModules(path string) ([]models.Module, error) {
      return nil, nil
    }
    
    // ListModulesWithDeps ...
    func (m *npm) ListModulesWithDeps(path string) ([]models.Module, error) {
      return nil, nil
    }
    
    
  7. In modules.go at ./pkg/modules/ directory, register the new plugin. Add the plugin to register to the existing definition.

    func init() {
        registeredPlugins = append(registeredPlugins,
                gomod.New(),
                npm.New(),
        )
    }
    
    

How to Work With SPDX SBOM Generator

A Makefile for the spdx-sbom-generator is described below with ability to run, test, lint, and build the project binary for different platforms (Linux, Mac, and Windows).

Perform the following steps to work with SPDX SBOM Generator:

  1. Run project on current directory.

    make generate
    

    you can provide the CLI parameters that will be passed along the command, for example:

    ARGS="--path /home/ubuntu/projects/expressjs" make generate
    
  2. Build Linux Intel/AMD 64-bit binary.

    make build
    
  3. Build Mac Intel/AMD 64-bit binary.

    make build-mac
    
  4. Build Mac ARM 64-bit binary.

    make build-mac-arm64
    
  5. Build Windows Intel/AMD 64-bit binary.

    make build-win
    

Licensing

This project’s source code is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Additional Information

SPDX

SPDX SBOM

SPDX Tools

SPDX License List

SPDX GitHub Repos

Comments
  • Ability to output to JSON

    Ability to output to JSON

    This pull request adds support for creating JSON SPDX SBOMs (thereby resolving #117 if merged)

    This is achieved by

    • Making the formatter/renderer modular (now implemented by a go interface)
    • Passing down the -f argument to the renderer so that it can use the appropriate implementation
    • Updating the Document and Package structs (which are now annotated as per the official JSON spec/example) to better resemble the structure specified by the SPDX spec
    • Updating the filename resolution logic to take into consideration the format passed down by the user

    Additionally, this pull request also completes the todo item of reimplementing the tag-value format (.spdx) renderer as a go template.

    opened by amithkk 9
  • Java - Maven - NOASSERTION is displayed for both PackageSupplier and PackageDownloadLocation even when values exists as per the conditions mentioned in specification

    Java - Maven - NOASSERTION is displayed for both PackageSupplier and PackageDownloadLocation even when values exists as per the conditions mentioned in specification

    @prathapbproximabiz Tool Version Tested with v.0.0.8 and as well as tested with binaries built from cloned code from main branch of https://github.com/spdx/spdx-sbom-generator on 27-06-2021 Test Repo https://github.com/mybatis/mybatis-3 OS Windows 10

    Observed that NOASSERTION is displayed for both PackageSupplier and PackageDownloadLocation for all packages even when values exists as per the conditions mentioned in specification SPDX files bom-Java-Maven_generated with Latest code.spdx.txt bom-Java-Maven_mybatis-3_v0.0.8_27-Jun-2021.spdx.txt bom-Java-Maven_sample-java-programs_v0.0.8_27-Jun-2021.spdx.txt bom-Java-Maven_zxing_v0.0.8_27-Jun-2021.spdx.txt

    Specification image

    Example image

    image

    bug java maven 
    opened by niruautomation 8
  • Python(Go) - poetry - dependencies listed in METADAT file are not displayed in SPDX file

    Python(Go) - poetry - dependencies listed in METADAT file are not displayed in SPDX file

    @lfpratik Tool Version Cloned code from main branch of https://github.com/spdx/spdx-sbom-generator on 11-06-2021 and built the tool Test Repo https://github.com/lfpratik/spdx-poetry-demo OS Windows 10

    1. Followed all prerequisite steps as per https://confluence.linuxfoundation.org/display/PROD/SPDX+-+Python+Module+-+Prerequisites+For+Windows
    2. Followed Prerequisite and Steps as per below screenshot image
    3. Execute ./spdx-sbom-generator
    4. Observed that all dependencies listed in METADAT file are not displayed in SPDX file Example1 image

    image

    Example2 image

    image

    bug golang python poetry 
    opened by niruautomation 5
  • .net - Warning message is displayed when SPDX file validated in the SPDX validator

    .net - Warning message is displayed when SPDX file validated in the SPDX validator

    @proximapc Tool Version v0.0.6 Test Repo https://github.com/dotnet-architecture/eShopOnWeb OS Windows 10

    1. Clone the repo
    2. Generate the SPDX file with command ./spdx-sbom-generator image

    Validate the SPDX file generated for rust in https://tools.spdx.org/app/validate/ Observed that warnings are displayed SPDX File bom-nuget.spdx.txt

    image

    bug .net 
    opened by niruautomation 5
  • Java - Maven - Warning message is displayed when SPDX file validated in the SPDX validator

    Java - Maven - Warning message is displayed when SPDX file validated in the SPDX validator

    Test Repo used for testing https://github.com/mlehotskylf/sample-java-programs

    1. Clone the https://github.com/spdx/spdx-sbom-generator.git from main branch (Since latest version tool is not available followed this approach for testing)
    2. Execute the make build-win to build the tool
    3. Generate the SPDX file for JAVA module
    4. Validate the generated SPDX file in https://tools.spdx.org/app/validate/
    5. Observed that the warning message is displayed. PFA SPDX file for reference image

    bom-Java-Maven.txt

    opened by niruautomation 5
  • panic: interface conversion: interface {} is string, not map[string]

    panic: interface conversion: interface {} is string, not map[string]

    Summary

    The builds for all merge requests are failing with the same error.

    This looks to have been introduced into the main branch with #250 (which was merged, despite the build failing!), or maybe that's just the first merge that was performed after there was a change to some underlying package).

    --- FAIL: TestNPM (0.02s)
        --- FAIL: TestNPM/test_list_all_modules (0.00s)
    panic: interface conversion: interface {} is string, not map[string]interface {} [recovered]
    	panic: interface conversion: interface {} is string, not map[string]interface {}
    goroutine 40 [running]:
    testing.tRunner.func1.2({0x876300, 0xc003247f20})
    	/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:[138](https://github.com/RodneyRichardson/spdx-sbom-generator/runs/7316980646?check_suite_focus=true#step:7:139)9 +0x24e
    testing.tRunner.func1()
    	/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1392 +0x39f
    panic({0x876300, 0xc003247f20})
    	/opt/hostedtoolcache/go/1.18.3/x64/src/runtime/panic.go:838 +0x207
    github.com/spdx/spdx-sbom-generator/pkg/modules/npm.appendDependencies(...)
    	/home/runner/work/spdx-sbom-generator/spdx-sbom-generator/pkg/modules/npm/handler.go:372
    github.com/spdx/spdx-sbom-generator/pkg/modules/npm.appendNestedDependencies(0x8e5420?)
    	/home/runner/work/spdx-sbom-generator/spdx-sbom-generator/pkg/modules/npm/handler.go:359 +0x48a
    github.com/spdx/spdx-sbom-generator/pkg/modules/npm.(*npm).buildDependencies(0xc00316dde8, {0xc000154c30, 0x4e}, 0x8?)
    	/home/runner/work/spdx-sbom-generator/spdx-sbom-generator/pkg/modules/npm/handler.go:209 +0x439
    github.com/spdx/spdx-sbom-generator/pkg/modules/npm.(*npm).ListModulesWithDeps(0x8f7a08?, {0xc000154c30, 0x4e}, {0x1?, 0x1?})
    	/home/runner/work/spdx-sbom-generator/spdx-sbom-generator/pkg/modules/npm/handler.go:185 +0x1ae
    github.com/spdx/spdx-sbom-generator/pkg/modules/npm.TestListAllModules(0x0?)
    	/home/runner/work/spdx-sbom-generator/spdx-sbom-generator/pkg/modules/npm/handler_test.go:104 +0x1aa
    testing.tRunner(0xc0030fbd40, 0x939038)
    	/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x102
    created by testing.(*T).Run
    	/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x35f
    FAIL	github.com/spdx/spdx-sbom-generator/pkg/modules/npm	0.232s
    

    Expected behavior

    All tests should pass.

    Repository

    Which repository causes this error?

    • https://github.com/spdx/spdx-sbom-generator

    Acceptance Criteria

    1. All existing unit tests pass

    References

    • https://github.com/opensbom-generator/spdx-sbom-generator/pull/250/checks
    bug 
    opened by RodneyRichardson 4
  • .NET - Value for PackageDownloadLocation is displayed as NOASSERTION even when value exists for {package.repository.url}

    .NET - Value for PackageDownloadLocation is displayed as NOASSERTION even when value exists for {package.repository.url}

    @proximapc Tool Version v0.0.8 Test Repo https://github.com/jasontaylordev/CleanArchitecture OS Windows 10

    Observed that value for PackageDownloadLocation is displayed as NOASSERTION even when value exists for {package.repository.url}. As per specification file {package.repository.url should be displayed for PackageDownloadLocation

    Specification file image

    Example1 Package-FluentValidation-9.3.0 image

    image

    Example2 Package-MediatR-9.0.0 image

    image

    Example3 Package-AutoMapper-10.0.0 image

    image

    bug .net 
    opened by niruautomation 4
  • Node- Yarn/NPM - NOASSERTION is displayed for PackageDownloadLocation even when values exists as per the conditions mentioned in specification

    Node- Yarn/NPM - NOASSERTION is displayed for PackageDownloadLocation even when values exists as per the conditions mentioned in specification

    @khalifapro Tool Version v0.0.8 Test Repo https://github.com/gothinkster/node-express-realworld-example-app OS Windows 10

    Observed that NOASSERTION is displayed for PackageDownloadLocation even when values exists as per the conditions mentioned in specification

    SPDX file bom-yarn_node-express-realworld-example-app_v0.0.8_27-Jun-2021.spdx.txt bom-yarn_typed-install_v0.0.8_27-Jun-2021.spdx.txt bom-yarn_bolt_v0.0.8_27-Jun-2021.spdx.txt bom-npm_node-red_v0.0.8_27-Jun-2021.spdx.txt

    Specification image

    Issue image

    image

    bug node yarn npm 
    opened by niruautomation 3
  • Missing ':' after 'Relationship' tags

    Missing ':' after 'Relationship' tags

    Summary

    When running spdx-sbom-generator on itself, the resulting SBOM is missing the colon (':') after each 'Relationship' tag.

    Background

    1. cloned main branch (a795777) and built for Linux Intel/AMD 64-bit version
    2. ran spdx-sbom-generator on its own directory

    Expected behavior

    Every "Relationship" tag should be followed by a colon (':') like other tags, but they are not.

    Screenshots

    missing-colons

    bug 
    opened by swinslow 3
  • Python(Go) - pipenv/venv - Details of Document and root package are not matching with the repo against which SPDX file is generated

    Python(Go) - pipenv/venv - Details of Document and root package are not matching with the repo against which SPDX file is generated

    @lfpratik Tool Version I cloned the code from master on 14-06-2021, build the tool and verified the ticket Test Repo https://github.com/lfpratik/spdx-pipenv-demo OS Windows 10

    1. Followed all prerequisite steps as per https://confluence.linuxfoundation.org/display/PROD/SPDX+-+Python+Module+-+Prerequisites+For+Windows
    2. Followed Prerequisite and Steps as per below screenshot image
    3. Execute ./spdx-sbom-generator
    4. Observed that SPDX file is generated but details of Document and root package are not matching with the repo against which SPDX file is generated

    image

    image

    bug golang python pipenv 
    opened by niruautomation 3
  • Java - Maven - PackageVersion field is not displayed and Version is not displayed for SPDXID for plugin when it is listed as package

    Java - Maven - PackageVersion field is not displayed and Version is not displayed for SPDXID for plugin when it is listed as package

    @prathapbproximabiz Tool Version Cloned code from main branch of https://github.com/spdx/spdx-sbom-generator on 11-06-2021 and built the tool Test Repo https://github.com/zxing/zxing OS Windows 10

    Issue1 PackageVersion field is not displayed for plugin when it is listed as package Issue2 Version is not displayed for SPDXID for plugin when it is listed as package

    SPDX file image

    pom.xml image

    bug java maven 
    opened by niruautomation 3
  • Not able to generate SBOM in json format

    Not able to generate SBOM in json format

    I want to generate SBOM in the JSON format. I used -f flag to do so. But not able to change the spdx (default format).

    I have followed the below steps:

    1. Download sbom-spdx-generator binary for the windows
    2. Run sbom-spdx-generator -f json
    3. Observe the SBOM file in spdx format

    Can someone please help me on this?

    bug 
    opened by sgugale 0
  • Use spdx/tools-golang rather than internal spdx.go file

    Use spdx/tools-golang rather than internal spdx.go file

    Upstream spdx tools already define structs which reflect the data model for each version of the specification. Rather than duplicate work, use the upstream models.

    tech debt 
    opened by nishakm 0
  • start of work to add spack

    start of work to add spack

    Hey @nishakm ! I am working on adding spack, and this is a WIP!

    I got pretty far today but hit a nil pointer reference and wanted to ask if you had any insights to this error?

    $ make generate
    Running cli on version: v0.0.15-5-ga08d08a
    INFO[2022-09-25T17:06:56-06:00] Starting to generate SPDX ...                
    INFO[2022-09-25T17:06:56-06:00] Running generator for Module Manager: `spack` with output `bom-spack.spdx` 
    INFO[2022-09-25T17:06:56-06:00] Current Language Version 0.19.0.dev0 (a08d6e790d3c4cfe7e084b75fdd1bfdc3981c2d5) 
    INFO[2022-09-25T17:06:56-06:00] Global Setting File                          
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x84746f]
    
    goroutine 1 [running]:
    github.com/spdx/spdx-sbom-generator/pkg/models.(*CheckSum).String(...)
            /home/vanessa/Desktop/Code/spdx-sbom-generator/pkg/models/models.go:108
    github.com/spdx/spdx-sbom-generator/pkg/format.(*Format).convertToPackage(_, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {{0x0, ...}, ...}, ...})
            /home/vanessa/Desktop/Code/spdx-sbom-generator/pkg/format/format.go:160 +0x14f
    github.com/spdx/spdx-sbom-generator/pkg/format.(*Format).annotateDocumentWithPackages(0x0?, {0xc00010c280?, 0x1, 0x0?}, 0xc00010a2a0)
            /home/vanessa/Desktop/Code/spdx-sbom-generator/pkg/format/format.go:114 +0x125
    github.com/spdx/spdx-sbom-generator/pkg/format.(*Format).Render(0xc003157b40)
            /home/vanessa/Desktop/Code/spdx-sbom-generator/pkg/format/format.go:63 +0x125
    github.com/spdx/spdx-sbom-generator/pkg/handler.(*spdxHandler).Run(0xc00010a1c0)
            /home/vanessa/Desktop/Code/spdx-sbom-generator/pkg/handler/spdx.go:106 +0x4fe
    main.generate(0x123c1a0, {0xaf8e0a?, 0x0?, 0x0?})
            /home/vanessa/Desktop/Code/spdx-sbom-generator/cmd/generator/generator.go:121 +0x373
    github.com/spf13/cobra.(*Command).execute(0x123c1a0, {0xc0000a81c0, 0x0, 0x0})
            /home/vanessa/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x663
    github.com/spf13/cobra.(*Command).ExecuteC(0x123c1a0)
            /home/vanessa/go/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x39c
    github.com/spf13/cobra.(*Command).Execute(...)
            /home/vanessa/go/pkg/mod/github.com/spf13/[email protected]/command.go:897
    main.main()
            /home/vanessa/Desktop/Code/spdx-sbom-generator/cmd/generator/generator.go:39 +0x65
    exit status 2
    make: *** [Makefile:32: generate] Error 1
    

    At first glance it looks to be an issue with the checksum String() but I tried changing to use bytes, removing it, and nothing has changed so (before I go out for my run) I thought it might be more useful to open this for discussion and help!

    Note that I am debugging the nil pointer reference and have commented out the other modules until then so I can easily run and see the spack error, and I haven't cleaned up the code yet. Also note that we can discuss the design - spack is typically installed to one root so instead of looking for it somehow in the PWD I look for spack on the path, and if it's found, we parse installed packages. Also ignore the make docker command - that was just for my local testing (and I'll be removing it!)

    This has been super fun to work on today - I hope I can help more after this too!

    Signed-off-by: vsoch [email protected]

    opened by vsoch 5
  • Support detection of triplet targets for Rust projects

    Support detection of triplet targets for Rust projects

    Summary

    For Rust, support detection of cross-compilation and list the system libraries used (glibc, musl, linker, compiler, etc).

    This may mean supporting .cargo/config.toml.

    This file has sections of [target.<triple>]. These sections specify settings for specific platform targets, see the config.toml docs.. These triplets can be used to compile against a different system library (musl instead of glibc for example), different machine architecture, etc, as usual. Example:

    # .cargo/config.toml
    
    [target.x86_64-unknown-linux-musl]
    linker = "x86_64-linux-musl-gcc"
    
    [target.aarch64-unknown-linux-musl]
    linker = "aarch64-linux-musl-gcc"
    

    Note that key options for those sections can be also overridden via env vars. Maybe there's a way to call cargo to obtain the end evaluation that takes into account the env vars.

    Background

    Right now, SBOM of a rust project compiled for amd64 and glibc is basically the same as if compiled for arm64 and musl. Instead, this information should be included in the SBOM.

    enhancement 
    opened by viccuad 0
  • Encourage user to attest to their SBOM

    Encourage user to attest to their SBOM

    Hi

    I'm one of the maintainers of OpenSSF project's SLSA native GitHub generators.

    We would like to encourage users to add a provenance attestation to their SBOM documents. We can add a section "SBOM attestations" in our own documentation.

    Similarly, encouraging users to generate SLSA attestation could be added to the documentation in this repo. Cross-linking to our repositories would be a great way to increase adoption of best practices across projects simultaneously.

    Here's what I think the documentation would look like on the slsa-generator repo:

    1. Download the binary from the opensbom-generator.
    2. Verify the SLSA provenance of the binary (once https://github.com/opensbom-generator/spdx-sbom-generator/issues/272 is complete), using the slsa-verifier (We are releasing a GitHub action installer in the next couple weeks)
    3. Run the sbomgenerator
    4. Add a step to generate the attestation to the SBOM.

    How does this sound? Would anyone be interested in helping out to make this happen?

    documentation 
    opened by laurentsimon 0
  • Generate SLSA signature / provenance for your artifacts

    Generate SLSA signature / provenance for your artifacts

    Hi,

    I'm reaching out on behalf of the Open Source Security Foundation (openssf.org), a project of the Linux Foundation. We work on improving the security of critical open source projects like yours.

    Together with GitHub, we designed a free, easy-to-use method of code signing It will help your users verify that your release artifacts were built from your repository’s and not altered by anyone. It’s just a few lines of code, but it will make your project more secure against third-party tampering and attacks like attacks like Codecov and CTX.

    You don’t have to be a cryptography expert or learn complicated tools and verification is simple for your users. There are examples here to integrate with GoReleaser, for example.

    We have onboarded several projects already, including urllib3, flatbuffers and grpc-gateway.

    It would be great to see your repository generate SLSA provenance as well!

    enhancement 
    opened by laurentsimon 0
Releases(v0.0.15)
Owner
null
Personal notetaking tooling

jot CLI Task List and Journal jot is a simple journaling program for CLI that helps you keep track of your life. Config File ~/.jot.yaml is read on st

Gabe Conradi 6 Aug 9, 2022
Silotools: Tooling for interacting with SiLos

KONG SiLo USB NFC Tool Description Node script for verifying KONG SiLos via a NFC USB reader such as the ACR-122. Learn more about SiLos at KONG Cash

KONG 0 Dec 8, 2021
Tooling for SiLos

Silotools Tooling for interacting with SiLos Ported to golang from kong-org/silo-usb-nfc Kong Discord Compatibility This tool requires a system with t

Ryan Miller 0 Dec 15, 2021
Code generation for golang's constructor

constructor Generate constructor for a given struct. Usage of constructor: -exclude string the fields to exclude. Use comma to specify multi

Alex Tan Hong Pin 0 Dec 26, 2021
:sunglasses:Package captcha provides an easy to use, unopinionated API for captcha generation

Package captcha provides an easy to use, unopinionated API for captcha generation. Why another captcha generator? I want a simple and framework-indepe

Weilin Shi 123 Nov 12, 2022
Set of functions/methods that will ease GO code generation

Set of functions/methods that will ease GO code generation

Matheus Leonel Balduino 1 Dec 1, 2021
Snowflake algorithm generation worker Id sequence

sequence snowflake algorithm generation worker Id sequence 使用雪花算法生成ID,生成100万个只需要

null 1 Jan 21, 2022
Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading.

Knit Knit is an inline code generation tool that combines the power of Go's text/template package with automatic spec file loading. Example openapi: "

Tyler 4 Sep 15, 2022
A simple Via CEP Wrapper to demonstrate GoLang tests usage

via-cep-wrapper A simple Via CEP Wrapper to demonstrate GoLang tests usage Purpose Demonstrate how struct services could make easy to build and test a

Bruno 3 May 18, 2022
:chart_with_upwards_trend: Monitors Go MemStats + System stats such as Memory, Swap and CPU and sends via UDP anywhere you want for logging etc...

Package stats Package stats allows for gathering of statistics regarding your Go application and system it is running on and sent them via UDP to a se

Go Playgound 163 Nov 10, 2022
DSV Parallel Processor takes input files and query specification via a spec file

DSV Parallel Processor Spec file DSV Parallel Processor takes input files and query specification via a spec file (conventionally named "spec.toml").

Wattanit Hotrakool 0 Oct 9, 2021
using go search the Marvel universe characters via marvel api

go-marvel-api using go search the Marvel universe characters via marvel api Build and run tests on the local environemnt Build the project $ go build

Burak KÖSE 1 Oct 5, 2021
Via Cep Wrapper is a api wrapper used to find address by zipcode (Brazil only)

Viacep Wrapper Viacep Wrapper is an API wrapper built with Golang used to find address by zipcode (Brazil only). This project was developed for study

PATRICK SEGANTINE 1 Jan 25, 2022
Functional Programming support for golang.(Streaming API)

Funtional Api for Golang Functional Programming support for golang.(Streaming API) The package can only be used with go 1.18. Do not try in lower vers

Tobias Yin 0 Dec 8, 2021
CoreFoundation Property List support for Go

PACKAGE package plist import "github.com/kballard/go-osx-plist" Package plist implements serializing and deserializing of property list

Lily Ballard 29 Mar 18, 2022
Prometheus support for go-metrics

go-metrics-prometheus This is a reporter for the go-metrics library which will post the metrics to the prometheus client registry . It just updates th

Csergő Bálint 76 Nov 13, 2022
Library to work with MimeHeaders and another mime types. Library support wildcards and parameters.

Mime header Motivation This library created to help people to parse media type data, like headers, and store and match it. The main features of the li

Anton Ohorodnyk 25 Nov 9, 2022
🏆 A decentralized layer to support NFT on Mixin Messenger and Kernel.

NFO A decentralized layer to support NFT on Mixin Kernel. This MTG sends back an NFT to the receiver whenever it receives a transaction with valid min

Mixin Network 17 Aug 14, 2022
The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platform for application delivery.

Bhojpur BSS - Business Support System The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platf

Bhojpur Consulting 0 Sep 26, 2022