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

common

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright (C) 2025 timbastin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const CannotCalculateRisk float64 = 0

Variables

This section is empty.

Functions

func AddSlashCommandsToDependencyVuln

func AddSlashCommandsToDependencyVuln(str *strings.Builder) *strings.Builder

func AddSlashCommandsToDependencyVulnADF

func AddSlashCommandsToDependencyVulnADF(adf *jira.ADF)

func AddSlashCommandsToFirstPartyVuln

func AddSlashCommandsToFirstPartyVuln(str *strings.Builder) *strings.Builder

func AddSlashCommandsToToFirstPartyVulnADF

func AddSlashCommandsToToFirstPartyVulnADF(adf *jira.ADF)

func WrapHTTPClient

func WrapHTTPClient(client *http.Client, wrap func(req *http.Request, next http.RoundTripper) (*http.Response, error))

Types

type Affected

type Affected struct {
	Package           Pkg            `json:"package"`
	Ranges            []Rng          `json:"ranges"`
	Versions          []string       `json:"versions"`
	DatabaseSpecific  map[string]any `json:"database_specific"`
	EcosystemSpecific map[string]any `json:"ecosystem_specific"`
}

type ArtifactLocation

type ArtifactLocation struct {
	URI       string `json:"uri"`
	URIBaseID string `json:"uriBaseId,omitempty"`
}

type BatchModelWriter

type BatchModelWriter[T Tabler, Tx any] interface {
	CreateBatch(tx Tx, ts []T) error
	SaveBatch(tx Tx, ts []T) error
	DeleteBatch(tx Tx, ids []T) error
}

type CacheTransport

type CacheTransport struct {
	// contains filtered or unexported fields
}

func NewCacheTransport

func NewCacheTransport(cacheSize int, expiration time.Duration) *CacheTransport

func (*CacheTransport) Handler

func (c *CacheTransport) Handler() func(req *http.Request, next http.RoundTripper) (*http.Response, error)

type ContentTreeElement

type ContentTreeElement struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Slug   string `json:"slug"`
	Assets []struct {
		ID    string `json:"id"`
		Title string `json:"title"`
		Slug  string `json:"slug"`
	} `json:"assets"`
}

type DependencyVulnHints

type DependencyVulnHints struct {
	AmountOpen              int `json:"amountOpen"`
	AmountFixed             int `json:"amountFixed"`
	AmountAccepted          int `json:"amountAccepted"`
	AmountFalsePositive     int `json:"amountFalsePositive"`
	AmountMarkedForTransfer int `json:"amountMarkedForTransfer"`
}

used to return information about other instances of a dependency vuln in other parts of an organization

type Driver

type Driver struct {
	Name  string `json:"name"`
	Rules []Rule `json:"rules"`
}

type Fingerprints

type Fingerprints struct {
	MatchBasedID          string `json:"matchBasedId/v1"`
	CalculatedFingerprint string `json:"calculatedFingerprint/v1"`
}

type GitlabIntegrationDTO

type GitlabIntegrationDTO struct {
	Name            string `json:"name"`
	ID              string `json:"id"`
	URL             string `json:"url"`
	ObfuscatedToken string `json:"obfuscatedToken"`
}

type JiraIntegrationDTO

type JiraIntegrationDTO struct {
	Name            string `json:"name"`
	ID              string `json:"id"`
	URL             string `json:"url"`
	ObfuscatedToken string `json:"obfuscatedToken"`
	UserEmail       string `json:"userEmail"`
}

type Location

type Location struct {
	PhysicalLocation PhysicalLocation `json:"physicalLocation"`
}

type ModelReader

type ModelReader[ID any, T Tabler] interface {
	Read(id ID) (T, error)
	List(ids []ID) ([]T, error)
	All() ([]T, error)
	Upsert(t *[]*T, conflictingColumns []clause.Column, updateOnly []string) error
}

type ModelWriter

type ModelWriter[ID any, T Tabler, Tx any] interface {
	Create(tx Tx, t *T) error
	Save(tx Tx, t *T) error

	Delete(tx Tx, id ID) error
	Activate(tx Tx, id ID) error
}

type OSV

type OSV struct {
	ID            string     `json:"id"`
	Summary       string     `json:"summary"`
	Modified      time.Time  `json:"modified"`
	Published     time.Time  `json:"published"`
	Related       []string   `json:"related"`
	Aliases       []string   `json:"aliases"`
	Affected      []Affected `json:"affected"`
	SchemaVersion string     `json:"schema_version"`
}

func (OSV) GetCVE

func (osv OSV) GetCVE() []string

func (OSV) IsCVE

func (osv OSV) IsCVE() bool

type OpenSourceInsightsProjectResponse

type OpenSourceInsightsProjectResponse struct {
	ProjectKey struct {
		ID string `json:"id"`
	} `json:"projectKey"`
	OpenIssuesCount int        `json:"openIssuesCount"`
	StarsCount      int        `json:"starsCount"`
	ForksCount      int        `json:"forksCount"`
	License         string     `json:"license"`
	Description     string     `json:"description"`
	Homepage        string     `json:"homepage"`
	Scorecard       *Scorecard `json:"scorecard"`
}

type OpenSourceInsightsVersionResponse

type OpenSourceInsightsVersionResponse struct {
	VersionKey struct {
		System  string `json:"system"`
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"versionKey"`
	PublishedAt  time.Time `json:"publishedAt"`
	IsDefault    bool      `json:"isDefault"`
	Licenses     []string  `json:"licenses"`
	AdvisoryKeys []any     `json:"advisoryKeys"`
	Links        []struct {
		Label string `json:"label"`
		URL   string `json:"url"`
	} `json:"links"`
	SlsaProvenances []any    `json:"slsaProvenances"`
	Attestations    []any    `json:"attestations"`
	Registries      []string `json:"registries"`
	RelatedProjects []struct {
		ProjectKey struct {
			ID string `json:"id"`
		} `json:"projectKey"`
		RelationProvenance string `json:"relationProvenance"`
		RelationType       string `json:"relationType"`
	} `json:"relatedProjects"`
}

type PartialFingerprints

type PartialFingerprints struct {
	CommitSha     string `json:"commitSha"`
	Email         string `json:"email"`
	Author        string `json:"author"`
	Date          string `json:"date"`
	CommitMessage string `json:"commitMessage"`
}

type PhysicalLocation

type PhysicalLocation struct {
	ArtifactLocation ArtifactLocation `json:"artifactLocation"`
	Region           Region           `json:"region"`
}

type Pkg

type Pkg struct {
	Name      string `json:"name"`
	Ecosystem string `json:"ecosystem"`
	Purl      string `json:"purl"`
}

type Properties

type Properties struct {
	Precision string   `json:"precision"`
	Tags      []string `json:"tags"`
}

type Region

type Region struct {
	StartLine   int  `json:"startLine"`
	StartColumn int  `json:"startColumn"`
	EndLine     int  `json:"endLine"`
	EndColumn   int  `json:"endColumn"`
	Snippet     Text `json:"snippet"`
}

type Repository

type Repository[ID any, T Tabler, Tx any] interface {
	ModelWriter[ID, T, Tx]
	ModelReader[ID, T]
	BatchModelWriter[T, Tx]
	Transactioner[Tx]
}

type Result

type Result struct {
	Kind                string `json:"kind"`
	RuleID              string `json:"ruleId"`
	Message             Text
	Locations           []Location           `json:"locations"`
	Properties          *Properties          `json:"properties,omitempty"`
	Fingerprints        *Fingerprints        `json:"fingerprints,omitempty"`
	PartialFingerprints *PartialFingerprints `json:"partialFingerprints,omitempty"`
}

type RiskCalculationReport

type RiskCalculationReport struct {
	EPSS                  float64 `json:"epss"`
	BaseScore             float64 `json:"baseScore"`
	ExploitExists         bool    `json:"exploitExists"`
	VerifiedExploitExists bool    `json:"verifiedExploitExists"`
	UnderAttack           bool    `json:"underAttack"`

	// environment information
	ConfidentialityRequirement string `json:"confidentialityRequirement"`
	IntegrityRequirement       string `json:"integrityRequirement"`
	AvailabilityRequirement    string `json:"availabilityRequirement"`

	Risk float64 `json:"risk"`

	Vector string `json:"vector"`
}

func (RiskCalculationReport) Map

func (r RiskCalculationReport) Map() map[string]any

func (RiskCalculationReport) String

func (r RiskCalculationReport) String() string

type RiskMetrics

type RiskMetrics struct {
	BaseScore                            float64 `json:"baseScore"`
	WithEnvironment                      float64 `json:"withEnvironment"`
	WithThreatIntelligence               float64 `json:"withThreatIntelligence"`
	WithEnvironmentAndThreatIntelligence float64 `json:"withEnvironmentAndThreatIntelligence"`
}

type Rng

type Rng struct {
	Type   string        `json:"type"`
	Repo   string        `json:"repo"`
	Events []SemverEvent `json:"events"`
}

type Rule

type Rule struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	FullDescription  Text   `json:"fullDescription"`
	Help             Text   `json:"help"`
	HelpURI          string `json:"helpURI"`
	ShortDescription Text   `json:"shortDescription"`
	Properties       map[string]any
}

type Run

type Run struct {
	Tool    Tool     `json:"tool"`
	Results []Result `json:"results"`
}

type SarifResult

type SarifResult struct {
	Version string `json:"version"`
	Schema  string `json:"$schema"`
	Runs    []Run  `json:"runs"`
}

type Scorecard

type Scorecard struct {
	Date       time.Time `json:"date"`
	Repository struct {
		Name   string `json:"name"`
		Commit string `json:"commit"`
	} `json:"repository"`
	Scorecard struct {
		Version string `json:"version"`
		Commit  string `json:"commit"`
	} `json:"scorecard"`
	Checks []struct {
		Name          string `json:"name"`
		Documentation struct {
			ShortDescription string `json:"shortDescription"`
			URL              string `json:"url"`
		} `json:"documentation"`
		Score   int    `json:"score"`
		Reason  string `json:"reason"`
		Details []any  `json:"details"`
	} `json:"checks"`
	OverallScore float64 `json:"overallScore"`
	Metadata     []any   `json:"metadata"`
}

type SemverEvent

type SemverEvent struct {
	Introduced string `json:"introduced,omitempty"`
	Fixed      string `json:"fixed,omitempty"`
}

type Tabler

type Tabler interface {
	TableName() string
}

type Text

type Text struct {
	Text     string `json:"text"`
	Markdown string `json:"markdown"`
}

type Tool

type Tool struct {
	Driver Driver `json:"driver"`
}

type Transactioner

type Transactioner[Tx any] interface {
	Transaction(func(tx Tx) error) error
	GetDB(tx Tx) Tx
	Begin() Tx
}

type WebhookIntegrationDTO

type WebhookIntegrationDTO struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	URL         string `json:"url"`
	SbomEnabled bool   `json:"sbomEnabled"`
	VulnEnabled bool   `json:"vulnEnabled"`
}

Jump to

Keyboard shortcuts

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