GithubHelp home page GithubHelp logo

riehlegroup / product-model-toolkit Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 4.0 7.83 MB

Product Model Toolkit for Managing Open Source Dependencies in Products

Makefile 0.44% Go 70.21% Dockerfile 1.03% Shell 0.49% HTML 3.71% PLpgSQL 24.12%

product-model-toolkit's Introduction

Product Model Toolkit for Managing Open Source Dependencies in Products

Build Go Report Card codebeat badge go.mod REUSE Compliance License

Introduction

The Product Model Toolkit helps you to manage third-party open source dependencies in your product. The toolkit itself is not a license scanner. Instead, it facilitates other license scanners to incorporate license and other information together with architectural information into a unified model.

Architecture Overview

Architecture concept

  1. The small CLI client shall facilitate already existing scanners. For that, it will start Docker container which itself contains the actual scanner and its dependencies. The result then will be sent to the server application or stored as a file for further use. This should help to compare the developed PHP specific deep scanner with other tools.

  2. The server application contains all functionalities needed to generate a software bill-of-materials (SBOM) of a product, represented by the elements in the figure. It is also responsible for storing a component graph into a database.

  3. A database optimized for graphs shall store the data. The DB shall provide a GraphQL interface, or allows to add a GraphQL interface to it.

  4. The PHP scanner performs a deep analysis of a web project and sends its result as a standardized representation (like the CLI client) to the server.

How to use it ?

  • run cd docker/scanner/ and then run docker-compose up -d
  • run run-server.sh script. The server and a postgres instance will be ready in a second.
  • copy the required input file to the server container. For this, use the following line:
    • docker cp <input-file> pmt_server:/<input-file>
  • run the required command according to the help command of cli or even scenario.sh file

if you don't want to use Docker, then there is also another option. All important commands needed to build, test, and run the applications are represented as Makefile rule. All available rules can be displayed with make help.

Project Structure

├── cmd/.................Main applications of this project which will be compiled as executables
│   ├── client/
│   │   └── cli.go......Client application entry point
│   └── server/
│       └── main.go......Server application entry point
├── docs/................Documentation
├── docker/..............Dockerfiles
│   ├── graphile/........PostGraphile
│   └── scanner/.........Scanner tools 
├── pkg/.................Library code for client and server
├── model/...............The model for representing a software product
└── README.md

Build

Build with make build the client and server application. The generated artifacts are pmtserver and pmtclient.

Test

Test with make test. This also produces a code coverage report as a file called coverage.out.

Run

Already built executable can be executed directly. For example ./pmtclient or ./pmtserver.

During development, go run cmd/client/main.go or go run cmd/server/main.go can be used to run a specific application.

Run client and server with -h as argument to show all available arguments.

Perform Scan with Client

To list all available scanner execute ./pmtclient -l

Example call: ./pmtclient [-s SCANNER] -i [PROJECT_DIR_TO_SCAN]

Scan with specific scanner: ./pmtclient -s Licensee -i ~/workspace/myProject

Scan with default scanner: ./pmtclient -i ~/workspace/myProject

If you run the client without arguments ./pmtclient it will use the default scanner and scan the current working directory.

API (Server)

General Info

When you start the server it will show you all available REST endpoints.

Base path: http://[hostname]:[port]/api/v1

Method Path Description
GET / Get all routes
GET /version Get version of server
GET /health Check if server is available
GET /products Get all stored products
GET /products/:id Get a product by its ID
POST /products/import Import a product from scanner results
POST /scanner Scan with different scanners
POST /products/export Import a product from scanner results
POST /spdx/search Search product components

Simple UI routes

Base path: http://[hostname]:[port]

Method Path Description
GET / Get index page
GET /products Get all products page
GET /find-product-by-id Get a product by id
POST /import Import a product from scanner results

API Documentation

You can find the Insomnia import file on docs folder.

License Crawler

PHP: product-model-php-plugin

Project description

This project includes these functionalities:

BOM Generation

  • Generate BOM artifacts as SDPX document.
  • Generate BOM artifacts as human readable representation.
  • Provide BOM information for custom reports.

License Compatibility Check

  • Generate full license compatibility report based on the product license and components' licenses.

SPDX support

  • Import the component graph from a SPDX document.
  • Export the component graph as SPDX document.
  • Import licence information from a SPDX document.

Diff

  • Validate if two component graphs are the same.
  • Validate if two components are the same.
  • Present the difference in components between two component graphs of the same product.
  • Present the difference in meta-data between two component graphs of the same product.

Search

  • Search for components by its name.
  • Search for components by its meta-data.

Data Merging

  • Merge license information from different sources into a SDPX license identifier representation.
  • Merge sub component graphs into the component graph.

Client Crawler

  • Executable crawler in a CI environment.
  • Facilitate other scanners running in Docker containers to collect license information.
  • Send scanned information to the server application via HTTP calls (REST).
  • Store scanned information as structured representation (SPDX, SBOM, etc.) as files.

Development

Add license and copyright header

If you have installed the REUSE Tool you execute the following commands to add the correct header to the files.

# For source code use
$ reuse addheader --copyright "Friedrich-Alexander University Erlangen-Nürnberg (FAU)" --license Apache-2.0 myFile.go

# For documentation and media files use
$ reuse addheader --copyright "Friedrich-Alexander University Erlangen-Nürnberg (FAU)" --license CC-BY-SA-4.0 myImage.png

# For configuration and data files use
$ reuse addheader --copyright "Friedrich-Alexander University Erlangen-Nürnberg (FAU)" --license CC0-1.0 myConfig.cfg

License

Copyright 2020 Friedrich-Alexander University Erlangen-Nürnberg (FAU)

This work (source code) is licensed under Apache-2.0.

Files other than source code are licensed as follows:

  • Configuration and data files are licensed under CC0-1.0.

  • Documentation is licensed under CC BY-SA 4.0.

See the LICENSES folder in the root of this project for license details.

product-model-toolkit's People

Contributors

andreas-bauer avatar dirkriehle avatar r21gh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

product-model-toolkit's Issues

Plugin architecture for scanner tools

A plugin architecture shall provide a generic way to define scanner tools as plugins, in from of a configuration file, to be easy extendable in the future.

Current development towards a plugin architecture is ongoing in the branch plugin architecture.

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.