Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyViolationActionIgnore    = "ignore"
	PolicyViolationActionFailBuild = "fail-build"
)

Variables

View Source
var DefaultConfig = Config{
	Endpoint:  "https://cloud.sbom.observer",
	Namespace: "default",
}

Functions

This section is empty.

Types

type Component

type Component struct {
	Id         string            `json:"id"`
	PackageURL string            `json:"packageUrl,omitempty"` // canonical external identifier
	Type       string            `json:"type"`
	Version    string            `json:"version,omitempty"`
	Hashes     map[string]string `json:"hashes,omitempty"` // sha256, sha512, etc
	Name       string            `json:"name"`             // display name
	Group      string            `json:"group,omitempty"`  // display name
	Internal   bool              `json:"internal"`
}

type Config

type Config struct {
	Endpoint  string `json:"endpoint"`
	Namespace string `json:"namespace"`
	Token     string `json:"token"`
}

type FileSource

type FileSource func(w io.Writer) error

type Namespace

type Namespace struct {
	TenantId string `json:"tenantId"`
	Space    string `json:"space"`
}

type ObserverClient

type ObserverClient struct {
	Config Config
}

func NewObserverClient

func NewObserverClient() *ObserverClient

NewObserverClient returns a new ObserverClient with default configuration

func NewObserverClientWithConfig

func NewObserverClientWithConfig(config Config) *ObserverClient

func (*ObserverClient) AnalyzeSBOM

func (c *ObserverClient) AnalyzeSBOM(filename string) (*SpeculateResponse, error)

func (*ObserverClient) UploadDirectory

func (c *ObserverClient) UploadDirectory(directoryPath string, fields map[string]string) error

func (*ObserverClient) UploadFile

func (c *ObserverClient) UploadFile(filename string, fields map[string]string) error

func (*ObserverClient) UploadSource

func (c *ObserverClient) UploadSource(filename string, source FileSource, fields map[string]string) error

type PolicyViolation

type PolicyViolation struct {
	// Id         string  `json:"id"`
	// PolicyId   string  `json:"policyId"`
	PolicyName string         `json:"policyName"` // display name
	Severity   float64        `json:"severity"`
	Message    string         `json:"message"`
	Details    string         `json:"details"`
	Link       string         `json:"link,omitempty"`
	Action     string         `json:"action,omitempty"` // recommended action
	Violator   PolicyViolator `json:"violator"`
}

type PolicyViolator

type PolicyViolator struct {
	Id      string `json:"id"`
	Type    string `json:"type"`            // entity type component, environment, deployment etc
	Group   string `json:"group,omitempty"` // display name
	Name    string `json:"name"`            // display name
	Version string `json:"version"`         // display name
}

type SeveritySummary

type SeveritySummary struct {
	// unknown
	NoRisk   int `json:"noRisk"`
	Low      int `json:"low"`
	Moderate int `json:"moderate"`
	High     int `json:"high"`
	Critical int `json:"critical"`
	Total    int `json:"total"`
}

type SpeculateResponse

type SpeculateResponse struct {
	Namespace Namespace `json:"ns"`
	// Attestations              []Attestation                   `json:"attestations,omitempty"`
	Subject                   Component                       `json:"subject,omitempty"`
	ComponentsCount           int                             `json:"componentsCount,omitempty"`
	VulnerableComponentsCount int                             `json:"vulnerableComponentsCount,omitempty"`
	Violations                []PolicyViolation               `json:"violations,omitempty"`
	Vulnerabilities           []SpeculateVulnerabilitySummary `json:"vulnerabilities,omitempty"`
	VulnerabilitiesSummary    SeveritySummary                 `json:"vulnerabilitiesSummary,omitempty"`
	ViolationsSummary         SeveritySummary                 `json:"violationsSummary,omitempty"`
	LicenseSummary            []SummaryLicense                `json:"licenseSummary,omitempty"`
}

type SpeculateVulnerabilitySummary

type SpeculateVulnerabilitySummary struct {
	VendorId        string                 `json:"vendorId"`
	PackageName     string                 `json:"packageName"`
	PackageVersion  string                 `json:"packageVersion"`
	Ecosystem       string                 `json:"ecosystem"`
	Title           string                 `json:"title"`
	Description     string                 `json:"description"`
	Published       *time.Time             `json:"published,omitempty"`    // Take from NVD
	LastModified    *time.Time             `json:"lastModified,omitempty"` // Take from NVD
	Severity        float64                `json:"severity"`
	EPSS            float32                `json:"epss,omitempty"`
	PatchAvailable  bool                   `json:"patchAvailable"`
	PatchedVersions []string               `json:"patchedVersions,omitempty"`
	Analysis        *VulnerabilityAnalysis `json:"analysis,omitempty"`
}

type SummaryLicense

type SummaryLicense struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	URL   string `json:"url"`
	Count int    `json:"count"`
}

type VulnerabilityAnalysis

type VulnerabilityAnalysis struct {
	Id            string    `json:"id"`
	Vulnerability string    `json:"vulnerability"`
	Affects       []string  `json:"affects"`
	State         string    `json:"state,omitempty"`
	Justification string    `json:"justification,omitempty"`
	Response      []string  `json:"response,omitempty"`
	Details       string    `json:"details,omitempty"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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