ghsa

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ghsa provides a vulnerability source backed by the GitHub Security Advisory API.

Index

Constants

View Source
const (
	DefaultAPIURL  = "https://api.github.com"
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Source)

Option configures a Source.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom API base URL.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithToken

func WithToken(token string) Option

WithToken sets the GitHub API token. Optional for public advisory data, but recommended to avoid rate limits.

type Source

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

Source implements vulns.Source using the GitHub Security Advisory API.

func New

func New(opts ...Option) *Source

New creates a new GHSA source.

func (*Source) Get

func (s *Source) Get(ctx context.Context, id string) (*vulns.Vulnerability, error)

Get fetches a specific vulnerability by ID.

func (*Source) Name

func (s *Source) Name() string

Name returns "ghsa".

func (*Source) Query

func (s *Source) Query(ctx context.Context, p *purl.PURL) ([]vulns.Vulnerability, error)

Query returns vulnerabilities affecting the package identified by the PURL.

func (*Source) QueryBatch

func (s *Source) QueryBatch(ctx context.Context, purls []*purl.PURL) ([][]vulns.Vulnerability, error)

QueryBatch queries multiple packages. GHSA doesn't have a batch API, so this makes individual requests.

Jump to

Keyboard shortcuts

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