github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package github implements the GitHub Security Advisories provider.

Index

Constants

View Source
const (
	ProviderName  = "github"
	SchemaName    = "github"
	SchemaVersion = "1"
	Version       = 2

	DefaultAdvisoriesPerPage = 100
	DefaultWorkers           = 1 // GitHub is cursor-based (sequential), workers don't help
	DefaultTimeout           = 2 * time.Minute

	// GitHub GraphQL rate limits:
	// - Primary: 5000 points per hour
	// - Secondary: 2000 points per MINUTE (more restrictive!)
	// Use conservative limit to stay under secondary (2000/min)
	RateLimit       = 1500 // Conservative (allows ~90 points/query)
	RateLimitWindow = time.Minute

	// API endpoint
	APIURL = "https://api.github.com/graphql"
)

Variables

This section is empty.

Functions

func Register

func Register()

Register adds the GitHub provider to the default registry.

Types

type GraphQLClient

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

GraphQLClient handles GitHub GraphQL API requests.

func NewGraphQLClient

func NewGraphQLClient(token string, limiter *ratelimit.Limiter, pageSize int, timeout time.Duration, debug bool) *GraphQLClient

NewGraphQLClient creates a new GitHub GraphQL client.

func (*GraphQLClient) FetchAll

func (c *GraphQLClient) FetchAll(ctx context.Context, updatedSince *time.Time, writer *store.SQLiteWriter) error

FetchAll fetches all security advisories, optionally filtered by updatedSince.

type Provider

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

Provider implements the GitHub Security Advisories provider.

func NewProvider

func NewProvider(cfg provider.GitHubConfig) (*Provider, error)

NewProvider creates a new GitHub provider.

func (*Provider) FetchAll

func (p *Provider) FetchAll(ctx context.Context) error

FetchAll downloads all security advisories. GitHub uses cursor-based pagination, so this is sequential but fast.

func (*Provider) FetchIncremental

func (p *Provider) FetchIncremental(ctx context.Context, lastUpdated time.Time) error

FetchIncremental downloads only advisories updated since lastUpdated.

func (*Provider) MetadataPath

func (p *Provider) MetadataPath() string

MetadataPath returns the path to metadata.json.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider identifier.

func (*Provider) ResultsPath

func (p *Provider) ResultsPath() string

ResultsPath returns the path to the SQLite database.

Jump to

Keyboard shortcuts

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