socketdev

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Type int    `json:"type"`
	Key  string `json:"key"`
}

Start of Package Info Types

type AlertDescription

type AlertDescription struct {
	Emoji         string            `json:"emoji"`
	Props         map[string]string `json:"props"`
	Title         string            `json:"title"`
	Suggestion    string            `json:"suggestion"`
	Description   string            `json:"description"`
	NextStepTitle string            `json:"nextStepTitle"`
}

type AlertType

type AlertType struct {
	Id        int                         `json:"id"`
	CreatedAt string                      `json:"created_at"`
	UpdatedAt string                      `json:"updated_at"`
	Type      string                      `json:"type"`
	I18n      map[string]AlertDescription `json:"i18n"`
	Category  string                      `json:"category"`
	Severity  float32                     `json:"severity"`
	Enabled   bool                        `json:"enabled"`
}

type AlertTypes

type AlertTypes map[int]AlertType

type Api

type Api struct {
	BaseUrl    string
	AlertTypes AlertTypes

	// Endpoints
	PollWithAlertsEndpoint string
	GetAlertTypesEndpoint  string
}

func NewSocketAPI

func NewSocketAPI() (*Api, error)

func (*Api) GetAlerts

func (c *Api) GetAlerts(purl string) ([]PackageInfo, error)

Fetches risk alerts for provided package url (purl) example: api.GetAlerts("pkg:maven/org.dependencytrack/dependency-track@4.1.0")

func (*Api) ProcessComponents

func (c *Api) ProcessComponents(bom *cdx.BOM, workers int) []PackageInfo

func (*Api) ProcessPurls added in v1.0.1

func (c *Api) ProcessPurls(purls []string, workers int) []PackageInfo

type Capabilities

type Capabilities struct {
	Env    bool `json:"env"`
	Eval   bool `json:"eval"`
	Fs     bool `json:"fs"`
	Net    bool `json:"net"`
	Shell  bool `json:"shell"`
	Unsafe bool `json:"unsafe"`
}

type PackageInfo

type PackageInfo struct {
	ID             string       `json:"id"`
	Type           string       `json:"type"`
	Name           string       `json:"name"`
	Namespace      string       `json:"namespace"`
	Files          string       `json:"files"`
	Version        string       `json:"version"`
	Qualifiers     Qualifiers   `json:"qualifiers"`
	Scores         Scores       `json:"scores"`
	Capabilities   Capabilities `json:"capabilities"`
	License        string       `json:"license"`
	Size           int          `json:"size"`
	State          string       `json:"state"`
	Alerts         []Alert      `json:"alerts"`
	LicenseDetails []any        `json:"licenseDetails"`
}

type Qualifiers

type Qualifiers struct {
	Ext string `json:"ext"`
}

type ResAlertTypes

type ResAlertTypes map[string]AlertType

type Scores

type Scores struct {
	SupplyChain   float64 `json:"supplyChain"`
	Quality       float64 `json:"quality"`
	Maintenance   float64 `json:"maintenance"`
	Vulnerability float64 `json:"vulnerability"`
	License       float64 `json:"license"`
	Overall       float64 `json:"overall"`
}

Jump to

Keyboard shortcuts

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