Code Monkey home page Code Monkey logo

transparency-exchange-api's Introduction

License Website Slack Invite Group Discussion Twitter

CycloneDX Transparency Exchange API Standard

NOTICE: This standard is currently in draft pending feedback from the community.

Introduction

This specification defines a standard, format agnostic, API for the exchange of BOMs between systems.

System and tooling implementors are encouraged to adopt this API standard for sending/receiving BOMs between systems. This will enable more widespread "out of the box" integration support in the BOM ecosystem.

Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC2119.

ABNF Syntax

ABNF syntax used as per RFC5234: Augmented BNF for Syntax Specifications: ABNF.

ABNF rules are used from RFC3986: Uniform Resource Identifier (URI): Generic Syntax - Appendix A. Collected ABNF for URI.

These additional rules are defined:

system-url       = supported-scheme ":" hier-part
                       ; a system defined URL
                       ; hier-part as defined in RFC3986
supported-scheme = "http" / "https"

See also: RFC7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

Specification Compliance

An API server/client can be referred to as compliant if it correctly implements any of the methods described within this specification. It is not a requirement to implement all the methods described.

BOM Retrieval

This method is for retrieving a BOM from a system.

The BOM retrieval URL MUST comply with this syntax:

bom-retrieval-url    = system-url "?" bom-identifier-query
bom-identifier-query = "bomIdentifier=" bom-identifier
bom-identifier       = *( pchar / "/" / "?" )
                        ; an identifier that uniquely identifies a BOM
                        ; pchar as defined in RFC3986

The HTTP request method MUST be GET.

For CycloneDX BOMs the bom-identifier MUST be either a CDX URN (https://www.iana.org/assignments/urn-formal/cdx) or a BOM serial number UUID URN (https://cyclonedx.org/docs/1.4/json/#serialNumber).

For SPDX documents the bom-identifier MUST be the SPDX Document Namespace (https://spdx.github.io/spdx-spec/document-creation-information/#65-spdx-document-namespace-field).

Server Requirements

Servers MAY require authorization. If authorization is required it MUST use the HTTP Authorization header. If a server requires authorization, and no Authorization request header is supplied by the client, the server MUST respond with a 401 Unauthorized response.

Servers MUST honour the requested content types in the Accept header. If the server does not support any of the requested content types a HTTP 406 response MUST be returned. The 406 response body MUST contain a list of server supported content types in the below format with text/plain content type.

media-type *(", " media-type)

e.g. application/vnd.cyclonedx+xml; version=1.4, application/vnd.cyclonedx+xml; version=1.3

API servers MUST provide the correct Content-Type HTTP response header. For example:

Content-Type: application/vnd.cyclonedx+xml; version=1.4

If a BOM serial number UUID URN is used as the bom-identifier, the server MUST respond with the latest available version of the BOM.

Client Requirements

Clients MUST support an optional Authorization header being specified.

Clients MUST provide a Accept HTTP request header. For example:

Accept: application/vnd.cyclonedx+xml; version=1.4, application/vnd.cyclonedx+xml; version=1.3

BOM Submission Endpoint

This method is for submitting a BOM to a system.

The BOM submission URL MUST comply with this syntax:

bom-submission-url = system-url

The HTTP request method MUST be POST.

Server Requirements

Servers MAY require authorization. If authorization is required it MUST use the HTTP Authorization header. If a server requires authorization, and no Authorization request header is supplied by the client, the server MUST respond with a 401 Unauthorized response.

Servers MUST honour the specified content type in the Content-Type header. If the server does not support the supplied content type a HTTP 415 Unsupported Media Type response MUST be returned. The 415 response body MUST contain a list of server supported content types in the below format with text/plain content type.

media-type *(", " media-type)

e.g. application/vnd.cyclonedx+xml; version=1.4, application/vnd.cyclonedx+xml; version=1.3

If the submitted BOM has been successfully submitted the API server MUST respond with an appropriate 2xx HTTP status code.

Client Requirements

Clients MUST support an optional Authorization header being specified.

Clients MUST provide the correct Content-Type HTTP request header. For example:

Content-Type: application/vnd.cyclonedx+xml; version=1.4

transparency-exchange-api's People

Contributors

coderpatros avatar stevespringett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transparency-exchange-api's Issues

CoSWID and SWID BOM Support

Hello ๐Ÿ‘‹. I have quickly reviewed the spec draft here and noticed that only CycloneDX and SPDX are identified. Is SWID, more specifically the compact CBOR alterntive in IETF RFC9393 supported? If not, would you open to contributions to align identifiers and other metadata from this other BOM format in this API spec?

Proposal for more RESTful URL Semantics for SBOM Retrieval

The current URL semantics for retrieving a BOM uses query parameters:

bom-retrieval-url    = system-url "?" bom-identifier-query
bom-identifier-query = "bomIdentifier=" bom-identifier
bom-identifier       = *( pchar / "/" / "?" )
                        ; an identifier that uniquely identifies a BOM
                        ; pchar as defined in RFC3986

However, in accordance with RESTful principles, using the path to represent resources is preferred over query parameters, especially when a resource can be uniquely identified by a specific parameter.

To better adhere to RESTful design principles, I'd like to propose updating the URL semantics as follows:

bom-retrieval-url    = system-url "/" bom-identifier
bom-identifier       = *( pchar / "/" / "?" )
                        ; an identifier that uniquely identifies a BOM
                        ; pchar as defined in RFC3986

Where the bom-identifier directly follows the system-url, making the URL structure clearer and more intuitive.

The current design for SBOM submission already adheres to RESTful principles. Specifically, SBOMs are submitted using a POST request to:

bom-submission-url = system-url

By modifying the retrieval URL, we can achieve consistent RESTful design across both submission and retrieval operations.

Use of Query Parameters for Filtering:
While proposing to change the URL semantics for retrieval, it's worth noting that query parameters are still valuable and can be used on the system-url for filtering mechanisms. For instance, when searching or narrowing down results based on certain criteria, query parameters can efficiently convey this information. The distinction is that for direct and unique resource identification, as with the bomIdentifier, the path component is preferable in line with RESTful design.

Add BOM Meta Endpoint

The idea behind a BOM Meta endpoint is to provide format, hash, and external signature information.

The BOM Meta retrieval would work similar to the existing BOM retrieval, but would return metadata rather than the BOM itself.

bom-meta-url = system-url "/" bom-identifier
bom-identifier    = segment
                        ; an identifier that uniquely identifies a BOM
                        ; NOTE: MUST be appropriately URI encoded
                        ; segment as defined in RFC3986

As an example, here's a snippet response for what I'm thinking about being returned:

{
  "spec": {
    "format": "CycloneDX",
    "version": "1.4",
    "mime-type": "application/vnd.cyclonedx+json",
  },
  "published": "2022-03-07T15:50+00Z",
  "checksum": [
    { "alg": "SHA-256", "value": "CF80CD8..." },
    { "alg": "SHA-512", "value": "CF80CD8..." },
    { "alg": "SHA3-256", "value": "CF80CD8..." },
    { "alg": "SHA3-512", "value": "CF80CD8..." },
    { "alg": "BLAKE3", "value": "CF80CD8..." }
  ],
  "signature": [
  
  ]
}

I think alg should be an enum with only those supported algorithms.

As for signatures, it would be ideal if we could support external signature files, signature services (e.g sigstore), and external inline.

Bom Post API should accept sbom payload as Base64 (URL Safe) encoded format.

A Bom Post API should accept a Bom payload as Base64 (URL Safe) encoded format.

Dependency track application also accepts Bom JSON as Base64 Encoded data.

Project CycloneDX/cyclonedx-bom-repo-server implemented Post API to accept it as plain text.

Curl sample from CycloneDX/cyclonedx-bom-repo-server

curl -X POST "https://www.example.com/bom" -H "accept: /" -H "Content-Type: application/vnd.cyclonedx+json; version=1.3" -d "{"bomFormat":"CycloneDX","specVersion":"1.3","serialNumber":"urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79","version":1,"components":[{"type":"library","name":"acme-library","version":"1.0.0"}]}"```

Need URN query

As a user, i do not know the URN of the SBOM I want to retrieve. This specification should define how I can determine the URN for an SBOM I want to retrieve, ideally by way of CPE, PURL or SWID, or potentially even by software file hash or some other unique identifier.

Retrieve by PURL

Are you considering an endpoint that could be given a PURL and return a list of bom-identifiers for SBOMs that describe that PURL? It might also be useful to have an endpoint to find bom-identifiers that depend on a PURL, but the former would be the more immediate need.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.