Documentation
¶
Index ¶
- type BaseResource
- type ContainerImage
- func (r *ContainerImage) Clone(path string) error
- func (r *ContainerImage) ClonePath() string
- func (r *ContainerImage) Contact() response.Contact
- func (r *ContainerImage) Depth() uint16
- func (r *ContainerImage) EnrichResult(result *response.Result) *response.Result
- func (r *ContainerImage) Kind() string
- func (r *ContainerImage) Priority() int
- func (r *ContainerImage) ReadFile(path string) ([]byte, error)
- func (r *ContainerImage) SetCloneTimeout(timeout time.Duration)
- func (r *ContainerImage) SetDepth(depth uint16)
- func (r *ContainerImage) Since() string
- func (r *ContainerImage) String() string
- func (r *ContainerImage) Walk(fn WalkFunc) error
- type ContainerImageOptions
- type Files
- func (r *Files) Clone(path string) error
- func (r *Files) ClonePath() string
- func (r *Files) Depth() uint16
- func (r *Files) EnrichResult(result *response.Result) *response.Result
- func (r *Files) Kind() string
- func (r *Files) Priority() int
- func (r *Files) ReadFile(path string) ([]byte, error)
- func (r *Files) SetCloneTimeout(timeout time.Duration)
- func (r *Files) SetDepth(depth uint16)
- func (r *Files) Since() string
- func (r *Files) String() string
- func (r *Files) Walk(fn WalkFunc) error
- type FilesOptions
- type GitRepo
- func (r *GitRepo) Clone(path string) error
- func (r *GitRepo) ClonePath() string
- func (r *GitRepo) Depth() uint16
- func (r *GitRepo) EnrichResult(result *response.Result) *response.Result
- func (r *GitRepo) GitDirPath() string
- func (r *GitRepo) Kind() string
- func (r *GitRepo) Priority() int
- func (r *GitRepo) ReadFile(path string) ([]byte, error)
- func (r *GitRepo) Refs() []string
- func (r *GitRepo) RemoteRefExists(ref string) bool
- func (r *GitRepo) SetCloneTimeout(timeout time.Duration)
- func (r *GitRepo) SetDepth(depth uint16)
- func (r *GitRepo) ShallowCommits() []string
- func (r *GitRepo) Since() string
- func (r *GitRepo) String() string
- func (r *GitRepo) Walk(fn WalkFunc) error
- type GitRepoOptions
- type JSONData
- func (r *JSONData) Clone(path string) error
- func (r *JSONData) ClonePath() string
- func (r *JSONData) Depth() uint16
- func (r *JSONData) EnrichResult(result *response.Result) *response.Result
- func (r *JSONData) Kind() string
- func (r *JSONData) Priority() int
- func (r *JSONData) ReadFile(path string) ([]byte, error)
- func (r *JSONData) SetCloneTimeout(timeout time.Duration)
- func (r *JSONData) SetDepth(depth uint16)
- func (r *JSONData) Since() string
- func (r *JSONData) String() string
- func (r *JSONData) Walk(fn WalkFunc) error
- type JSONDataOptions
- type Resource
- type URL
- func (r *URL) Clone(path string) error
- func (r *URL) ClonePath() string
- func (r *URL) Depth() uint16
- func (r *URL) EnrichResult(result *response.Result) *response.Result
- func (r *URL) Kind() string
- func (r *URL) Priority() int
- func (r *URL) ReadFile(path string) ([]byte, error)
- func (r *URL) SetCloneTimeout(timeout time.Duration)
- func (r *URL) SetDepth(depth uint16)
- func (r *URL) Since() string
- func (r *URL) String() string
- func (r *URL) Walk(fn WalkFunc) error
- type URLOptions
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResource ¶
type BaseResource struct {
// contains filtered or unexported fields
}
BaseResource is a mixin to handle some of the common resource related methods
func (*BaseResource) ID ¶
func (r *BaseResource) ID() string
ID returns a path-safe, unique id for this resource
type ContainerImage ¶ added in v0.0.7
type ContainerImage struct { // Provide common helper functions BaseResource // contains filtered or unexported fields }
ContainerImage provides a pull and hold a container
func NewContainerImage ¶ added in v0.0.7
func NewContainerImage(location string, options *ContainerImageOptions) *ContainerImage
NewContainerImage returns a configured ContainerImage resource for the scanner to scan
func (*ContainerImage) Clone ¶ added in v0.0.7
func (r *ContainerImage) Clone(path string) error
Clone the resource to the desired clonePath location
func (*ContainerImage) ClonePath ¶ added in v0.0.7
func (r *ContainerImage) ClonePath() string
ClonePath returns where this repo has been cloned if cloned else ""
func (*ContainerImage) Contact ¶ added in v0.0.7
func (r *ContainerImage) Contact() response.Contact
Contact Attempts to identify author information returing name and email if found The order was selected for most completeness with a preference to maintainer and OCI spec Returns the name and email
func (*ContainerImage) Depth ¶ added in v0.0.7
func (r *ContainerImage) Depth() uint16
Depth returns the depth for things that have version control
func (*ContainerImage) EnrichResult ¶ added in v0.0.7
func (r *ContainerImage) EnrichResult(result *response.Result) *response.Result
EnrichResult adds contextual information to each result
func (*ContainerImage) Kind ¶ added in v0.0.7
func (r *ContainerImage) Kind() string
Kind of resource (always returns ContainerImage here)
func (*ContainerImage) Priority ¶ added in v0.0.7
func (r *ContainerImage) Priority() int
Priority returns the scan priority
func (*ContainerImage) ReadFile ¶ added in v0.0.7
func (r *ContainerImage) ReadFile(path string) ([]byte, error)
ReadFile provides a way to access values in the resource
func (*ContainerImage) SetCloneTimeout ¶ added in v0.0.7
func (r *ContainerImage) SetCloneTimeout(timeout time.Duration)
SetCloneTimeout lets you adjust the timeout before the clone aborts
func (*ContainerImage) SetDepth ¶ added in v0.0.7
func (r *ContainerImage) SetDepth(depth uint16)
SetDepth allows you to adjust the depth for the resource
func (*ContainerImage) Since ¶ added in v0.0.7
func (r *ContainerImage) Since() string
Since returns the date after which things should be scanned for containers that have history
func (*ContainerImage) String ¶ added in v0.0.7
func (r *ContainerImage) String() string
String representation of the resource
func (*ContainerImage) Walk ¶ added in v0.0.7
func (r *ContainerImage) Walk(fn WalkFunc) error
Walk traverses the resource like a directory tree
type ContainerImageOptions ¶ added in v0.0.7
type ContainerImageOptions struct { // A preferred arch, if it exists - defaults to first Arch string `json:"arch"` // Set the number of layers to download, counting from the top down. Depth uint16 `json:"depth"` // A list of layer hashes to exclude from clone and scan Exclusions []string `json:"exclusions"` // The scan priority Priority int `json:"priority"` // Only scan since this date Since string `json:"since"` }
ContainerImageOptions are options for the ContainerImage resource
type Files ¶
type Files struct { // Provide common helper functions BaseResource // contains filtered or unexported fields }
Files provides a way to scan file systems
func NewFiles ¶
func NewFiles(path string, options *FilesOptions) *Files
NewFiles returns a configured Files resource for the scanner to scan
func (*Files) EnrichResult ¶ added in v0.0.7
EnrichResult enriches the result with contextual information
func (*Files) SetCloneTimeout ¶
SetCloneTimeout lets you adjust the timeout before the clone aborts
type FilesOptions ¶
type FilesOptions struct { // The scan priority Priority int `json:"priority"` }
FilesOptions are options for the Files resource
type GitRepo ¶
type GitRepo struct { // Provide common helper functions BaseResource // contains filtered or unexported fields }
GitRepo provides a way to interact with a git repo
func NewGitRepo ¶
func NewGitRepo(cloneURL string, options *GitRepoOptions) *GitRepo
NewGitRepo returns a configured git repo resource for the scanner to scan
func (*GitRepo) EnrichResult ¶ added in v0.0.7
EnrichResult enriches the result with contextual information
func (*GitRepo) GitDirPath ¶
GitDirPath returns the path to the git dir so that other things don't need to know how the repo was cloned
func (*GitRepo) RemoteRefExists ¶
RemoteRefExists checks the remote repository to see if the ref exists
func (*GitRepo) SetCloneTimeout ¶
SetCloneTimeout lets you adjust the timeout before the clone aborts
func (*GitRepo) ShallowCommits ¶
ShallowCommits returns a list of shallow commits in a git repo
type GitRepoOptions ¶
type GitRepoOptions struct { // Only scan this branch Branch string `json:"branch"` // Only scan this many commits (reduced if larger than the max scan depth) Depth uint16 `json:"depth"` // Only scan since this date Since string `json:"since"` // Work through a proxy for this request Proxy string `json:"proxy"` // The scan priority Priority int `json:"priority"` }
GitRepoOptions stores options specific to GitRepo scan requests
type JSONData ¶
type JSONData struct { // Provide common helper functions BaseResource // contains filtered or unexported fields }
JSONData provides a way to interact with a json data as a resource
func NewJSONData ¶
func NewJSONData(raw string, options *JSONDataOptions) *JSONData
NewJSONData returns a configured JSONData resource for the scanner to scan
func (*JSONData) EnrichResult ¶ added in v0.0.7
EnrichResult enriches the result with contextual information
func (*JSONData) SetCloneTimeout ¶
SetCloneTimeout lets you adjust the timeout before the clone aborts
type JSONDataOptions ¶
type JSONDataOptions struct { FetchURLs bool `json:"fetch_urls"` // The scan priority Priority int `json:"priority"` }
JSONDataOptions are options for the JSONData resource
type Resource ¶
type Resource interface { Clone(path string) error ClonePath() string Depth() uint16 EnrichResult(result *response.Result) *response.Result ID() string Kind() string Priority() int ReadFile(path string) ([]byte, error) SetCloneTimeout(timeout time.Duration) SetDepth(depth uint16) Since() string String() string // Walk is the main way to pick through resource data (except for GitRepo) Walk(WalkFunc) error }
Resource provides a standard interface for acting with resources in the scanner
func NewResource ¶
func NewResource(kind, resource string, options json.RawMessage) (Resource, error)
NewResource handles building out the resource from kind, the resource string and the options as a raw json message
type URL ¶
type URL struct { // Provide common helper functions BaseResource // contains filtered or unexported fields }
URL provides a to pull remote content by a URL
func NewURL ¶
func NewURL(url string, options *URLOptions) *URL
NewURL returns a configured URL resource for the scanner to scan
func (*URL) EnrichResult ¶ added in v0.0.7
EnrichResult enriches the result with contextual information
func (*URL) SetCloneTimeout ¶
SetCloneTimeout lets you adjust the timeout before the clone aborts
type URLOptions ¶
type URLOptions struct { // The scan priority Priority int `json:"priority"` }
URLOptions are options for the URL resource