Documentation ¶
Index ¶
- Constants
- Variables
- func TrivyReportToEnt(report *TrivyReport, now time.Time) (pkgList []*ent.PackageRecord, vulnList []*ent.Vulnerability)
- type Config
- type Context
- type GetRepoScanRequest
- type GitHubBranch
- type GitHubCheckResult
- type GitHubRepo
- type GitHubToken
- type Package
- type PackageSource
- type PushTrivyResultRequest
- type Report
- type Repository
- type RequestRepoLabel
- type RequestSeverity
- type RespVulnerability
- type ScanReport
- type ScanRepositoryRequest
- type ScanTarget
- type SourceChanges
- type TrivyReport
- type UpdateVulnStatusRequest
- type VulnChanges
- type VulnRecord
- type VulnStatusDB
- type Vulnerability
Constants ¶
View Source
const ( VulnAdded vulnChangeType = iota VulnDeleted VulnRemained )
View Source
const (
ContextKeyLogger = "logger"
)
View Source
const (
Version = "0.0.1"
)
Variables ¶
View Source
var ( ErrDatabaseUnexpected = goerr.New("database failure") ErrDatabaseInvalidInput = goerr.New("invalid input for database") ErrItemNotFound = goerr.New("item not found") ErrInvalidSystemValue = goerr.New("invalid system value") ErrInvalidGitHubData = goerr.New("invalid github data") ErrInvalidInput = goerr.New("invalid input data") ErrAuthenticationFailed = goerr.New("authentication failed") ErrNotAuthenticated = goerr.New("not authenticated request") ErrNotAuthorized = goerr.New("not authorized request") ErrUserNotFound = goerr.New("user not found") ErrVulnerabilityNotFound = goerr.New("vulnerability not found") ErrInvalidWebhookData = goerr.New("invalid webhook data") ErrGitHubAPI = goerr.New("github API returns unexpected response") // Rule error ErrInvalidPolicyResult = goerr.New("invalid rule result") )
Functions ¶
func TrivyReportToEnt ¶
func TrivyReportToEnt(report *TrivyReport, now time.Time) (pkgList []*ent.PackageRecord, vulnList []*ent.Vulnerability)
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func NewContextWith ¶
type GetRepoScanRequest ¶ added in v0.1.4
type GetRepoScanRequest struct { GitHubRepo Limit int `json:"limit"` Offset int `json:"offset"` }
type GitHubBranch ¶
type GitHubBranch struct { GitHubRepo Branch string `json:"branch"` }
type GitHubCheckResult ¶ added in v0.1.2
type GitHubRepo ¶
type GitHubToken ¶
type Package ¶ added in v0.1.2
type Package struct { ent.PackageRecord Vulnerabilities []*Vulnerability `json:"vulnerabilities,omitempty"` // To remove "edges" field in JSON Edges *struct{} `json:"edges,omitempty"` }
type PackageSource ¶ added in v0.1.2
type PushTrivyResultRequest ¶ added in v0.1.10
type PushTrivyResultRequest struct { Target ScanTarget Report TrivyReport }
func (*PushTrivyResultRequest) IsValid ¶ added in v0.1.10
func (x *PushTrivyResultRequest) IsValid() error
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
func MakeReport ¶
func MakeReport(scanID string, changes VulnChanges, db *VulnStatusDB, url string) *Report
func (*Report) NothingToNotify ¶
func (*Report) ToMarkdown ¶ added in v0.1.2
type Repository ¶ added in v0.1.5
type Repository struct { GitHubBranch Labels []string `json:"labels"` DefaultBranch string `json:"default_branch"` }
type RequestRepoLabel ¶ added in v0.1.4
type RequestRepoLabel struct { Name string `json:"name"` Description string `json:"description"` Color string `json:"color"` }
func (*RequestRepoLabel) IsValid ¶ added in v0.1.4
func (x *RequestRepoLabel) IsValid() error
type RequestSeverity ¶ added in v0.1.1
func (*RequestSeverity) IsValid ¶ added in v0.1.1
func (x *RequestSeverity) IsValid() error
type RespVulnerability ¶
type RespVulnerability struct { Vulnerability *ent.Vulnerability `json:"vulnerability"` Affected []*ent.Repository `json:"affected"` }
type ScanReport ¶ added in v0.1.5
type ScanReport struct { Repo Repository `json:"repo"` CommitID string `json:"commit_id"` Sources []*PackageSource `json:"sources"` }
func NewScanReport ¶ added in v0.1.5
func NewScanReport(scan *ent.Scan, statuses []*ent.VulnStatus, now int64) *ScanReport
type ScanRepositoryRequest ¶
type ScanRepositoryRequest struct { ScanTarget InstallID int64 PullReqNumber *int PullReqAction string }
type ScanTarget ¶
type SourceChanges ¶
type SourceChanges struct { Added VulnChanges Deleted VulnChanges Remained VulnChanges }
type TrivyReport ¶
type UpdateVulnStatusRequest ¶
type UpdateVulnStatusRequest struct { GitHubRepo UserID int ent.VulnStatus }
type VulnChanges ¶
type VulnChanges []*vulnChange
func DiffVulnRecords ¶
func DiffVulnRecords(oldPkgs, newPkgs []*ent.PackageRecord) VulnChanges
func (VulnChanges) FilterBySource ¶
func (x VulnChanges) FilterBySource(src string) VulnChanges
func (VulnChanges) FilterByType ¶
func (x VulnChanges) FilterByType(t vulnChangeType) VulnChanges
func (VulnChanges) Qualified ¶
func (x VulnChanges) Qualified(db *VulnStatusDB) VulnChanges
func (VulnChanges) Sources ¶
func (x VulnChanges) Sources() []string
type VulnRecord ¶
type VulnRecord struct { Pkg *ent.PackageRecord Vuln *ent.Vulnerability }
type VulnStatusDB ¶
type VulnStatusDB struct {
// contains filtered or unexported fields
}
func NewVulnStatusDB ¶
func NewVulnStatusDB(statuses []*ent.VulnStatus, now int64) *VulnStatusDB
func (*VulnStatusDB) IsQualified ¶
func (x *VulnStatusDB) IsQualified(v *VulnRecord) bool
func (*VulnStatusDB) Lookup ¶ added in v0.1.2
func (x *VulnStatusDB) Lookup(pkg *ent.PackageRecord, vulnID string) *ent.VulnStatus
type Vulnerability ¶ added in v0.1.2
type Vulnerability struct { ent.Vulnerability Status *ent.VulnStatus `json:"status,omitempty"` CustomSeverity string `json:"custom_severity"` // To remove "edges" field in JSON Edges *struct{} `json:"edges,omitempty"` }
Click to show internal directories.
Click to hide internal directories.