types

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package types is the collection of main data types used by the Trusty libraries

Index

Constants

This section is empty.

Variables

View Source
var Ecosystems = map[string]Ecosystem{
	"ECOSYSTEM_NPM":  ECOSYSTEM_NPM,
	"ECOSYSTEM_GO":   ECOSYSTEM_GO,
	"ECOSYSTEM_PYPI": ECOSYSTEM_PYPI,
}

Ecosystems enumerates the supported ecosystems

Functions

func ConvertDepsToMap

func ConvertDepsToMap(deps []Dependency) map[string]string

ConvertDepsToMap converts a slice of Dependency structs to a map for easier comparison

func DiffDependencies

func DiffDependencies(oldDeps, newDeps map[string]string) map[string]string

DiffDependencies compares two sets of dependencies (represented as maps) and finds what's added in newDeps.

Types

type Alternative added in v0.1.0

type Alternative struct {
	PackageName    string  `json:"package_name"`
	Score          float64 `json:"score"`
	PackageNameURL string
}

Alternative is an alternative package returned from the package intelligence API

type AlternativesList added in v0.1.0

type AlternativesList struct {
	Status   string        `json:"status"`
	Packages []Alternative `json:"packages"`
}

AlternativesList is the alternatives block in the trusty API response

type Dependency

type Dependency struct {
	Name      string
	Version   string
	Ecosystem Ecosystem
}

Dependency represents a generic dependency structure

type Ecosystem added in v0.1.0

type Ecosystem int32

Ecosystem is an identifier of a packaging system supported by Trusty

const (
	// ECOSYSTEM_NPM identifies the NPM ecosystem
	ECOSYSTEM_NPM Ecosystem = 1

	// ECOSYSTEM_GO identifies the Go language
	ECOSYSTEM_GO Ecosystem = 2

	// ECOSYSTEM_PYPI identifies the Python Package Index
	ECOSYSTEM_PYPI Ecosystem = 3
)

func (Ecosystem) AsString added in v0.1.0

func (ecosystem Ecosystem) AsString() string

AsString returns the string representation of the DepEcosystem

type HistoricalProvenance added in v0.1.0

type HistoricalProvenance struct {
	Tags     float64 `json:"tags"`
	Common   float64 `json:"common"`
	Overlap  float64 `json:"overlap"`
	Versions float64 `json:"versions"`
}

HistoricalProvenance has the historical provenance components from a package

type MaliciousData added in v0.1.0

type MaliciousData struct {
	Summary   string     `json:"summary"`
	Details   string     `json:"details"`
	Published *time.Time `json:"published"`
	Modified  *time.Time `json:"modified"`
	Source    string     `json:"source"`
}

MaliciousData contains the security details when a dependency is malicious

type PackageData added in v0.1.0

type PackageData struct {
	Archived   bool           `json:"archived"`
	Deprecated bool           `json:"is_deprecated"`
	Malicious  *MaliciousData `json:"malicious"`
}

PackageData contains the data about the queried package

type Provenance added in v0.1.0

type Provenance struct {
	Score       float64               `json:"score"`
	Description ProvenanceDescription `json:"description"`
}

Provenance has the package's provenance score and provenance type components

type ProvenanceDescription added in v0.1.0

type ProvenanceDescription struct {
	Historical HistoricalProvenance `json:"hp"`
	Sigstore   SigstoreProvenance   `json:"provenance"`
}

ProvenanceDescription contians the provenance types

type Reply added in v0.1.0

type Reply struct {
	PackageName  string           `json:"package_name"`
	PackageType  string           `json:"package_type"`
	Summary      ScoreSummary     `json:"summary"`
	Alternatives AlternativesList `json:"alternatives"`
	PackageData  PackageData      `json:"package_data"`
	Provenance   *Provenance      `json:"provenance"`
}

Reply is the response from the package report API

type ScoreSummary added in v0.1.0

type ScoreSummary struct {
	Score       *float64       `json:"score"`
	Description map[string]any `json:"description"`
}

ScoreSummary is the summary score returned from the package intelligence API

type SigstoreProvenance added in v0.1.0

type SigstoreProvenance struct {
	Issuer           string `json:"issuer"`
	Workflow         string `json:"workflow"`
	SourceRepository string `json:"source_repo"`
	TokenIssuer      string `json:"token_issuer"`
	Transparency     string `json:"transparency"`
}

SigstoreProvenance has the sigstore certificate data when a package was signed using a github actions workflow

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL