types

package
v0.0.0-...-238917c Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advisory

type Advisory struct {
	Severity       string `json:"severity"`
	Recommendation string `json:"recommendation"`
	ModuleName     string `json:"module_name"`
}

type Check

type Check interface {
	// Name of the check.
	Name() string

	// PerformCheck runs the check on the specified package.
	// If the check fails then the return bool will be False and the string will
	// contain a reason explaining the failure.
	// If the check passwes then the return bool will be True and the string
	// will be empty.
	// If error is non-nil then bool will be False and reason will be empty.
	PerformCheck(packageName, packageVersion string, npmPackage *NpmPackage) (bool, string, error)
}

Check is the interface implemented by all checks.

type ChecksManager

type ChecksManager interface {
	// PerformChecks returns False when a package fails checks and also returns a
	// descriptive reason why. Returns True when package passes all checks.
	// If an error is returned then False and an empty string will also be
	// returned.
	PerformChecks(packageRequestURL string) (bool, string, error)
}

ChecksManager helps callers perform checks on a particular project.

type DownloadedPackagesExaminer

type DownloadedPackagesExaminer interface {
	// StartExamination examines all the downloaded packages of a mirror.
	StartExamination(ctx context.Context, pollInternal time.Duration)
}

DownloadedPackagesExaminer examines all the downloaded packages of a mirror.

type IIssueTrackerService

type IIssueTrackerService interface {
	// MakeIssue files a new issue using the provided parameters.
	MakeIssue(title, body, owner string) (*issuetracker.Issue, error)

	// GetIssue finds the specified issueID and returns the issue object.
	GetIssue(issueId int64) (*issuetracker.Issue, error)
}

IIssueTrackerService is the interface for issue tracker calls.

type NpmAuditData

type NpmAuditData struct {
	// When the audit issue was created.
	Created time.Time `firestore:"created"`
	// The ID of the issue tracker issue.
	IssueId int64 `firestore:"issue_id"`
}

NpmAuditData is the type that will be stored in the DB.

type NpmAuditMetadata

type NpmAuditMetadata struct {
	Vulnerabilities map[string]int `json:"vulnerabilities"`
}

type NpmAuditOutput

type NpmAuditOutput struct {
	Advisories           map[string]Advisory `json:"advisories"`
	Metadata             NpmAuditMetadata    `json:"metadata"`
	Dependencies         string              `json:"dependencies"`
	DevDependencies      string              `json:"devDependencies"`
	OptionalDependencies string              `json:"optionalDependencies"`
	TotalDependencies    string              `json:"totalDependencies"`
}

Types used to parse output of the `npm audit` command.

type NpmDB

type NpmDB interface {
	// GetFromDB returns an NpmAuditData document snapshot from Firestore. If the
	// document is not found then (nil, nil) is returned.
	GetFromDB(ctx context.Context, key string) (*NpmAuditData, error)

	// PutInDB puts NpmAuditData into the DB. If the specified key already exists
	// then it is updated.
	PutInDB(ctx context.Context, key string, issueId int64, created time.Time) error
}

NpmDB is the interface implemented by all DB clients.

type NpmPackage

type NpmPackage struct {
	Time     map[string]string     `json:"time"`
	Versions map[string]NpmVersion `json:"versions"`
}

NpmPackage types to parse responses from the NPM global registry.

type NpmPackageTime

type NpmPackageTime struct {
	Versions map[string]string
}

type NpmVersion

type NpmVersion struct {
	Dependencies map[string]string `json:"dependencies"`
	License      interface{}       `json:"license"`
}

type PackageDetails

type PackageDetails struct {
	NameWithScope string
	ScopeName     string
	TarballName   string
	Version       string
}

PackageDetails is populated by parsing a packageRequestURL and used in checks_manager.

type ProjectAudit

type ProjectAudit interface {
	// StartAudit starts the auditing of the project in a goroutine.
	StartAudit(ctx context.Context, pollInterval time.Duration)
}

ProjectAudit is the interface implemented by all project audits.

type ProjectMirror

type ProjectMirror interface {
	// Name of the project this mirror was created for.
	GetProjectName() string

	// StartMirror starts the project's mirror in a goroutine.
	StartMirror(ctx context.Context, port int) error

	// AddToDownloadedPackageTarballs adds the provided package to the
	// in-memory map of installed packages. This is done to avoid expensive
	// calls by calling the filesystem.
	AddToDownloadedPackageTarballs(packageTarballName string)

	// IsPackageTarballDownloaded checks to see whether the specified
	// tarball has already been downloaded by the mirror.
	IsPackageTarballDownloaded(packageTarballName string) bool

	// GetDownloadedPackageNames examines the cache of downloaded packages on the
	// mirror and returns a slice of all package names.
	GetDownloadedPackageNames() ([]string, error)
}

ProjectMirror is the interface implemented by all project mirrors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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