scanner

package
v3.9.1-2868 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ScannerPathPrefix = "/twirp/trivy.scanner.v1.Scanner/"

ScannerPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var File_rpc_scanner_service_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type Licenses

type Licenses struct {
	Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"`
	// contains filtered or unexported fields
}

cf. https://stackoverflow.com/questions/38886789/protobuf3-how-to-describe-map-of-repeated-string

func (*Licenses) Descriptor deprecated

func (*Licenses) Descriptor() ([]byte, []int)

Deprecated: Use Licenses.ProtoReflect.Descriptor instead.

func (*Licenses) GetNames

func (x *Licenses) GetNames() []string

func (*Licenses) ProtoMessage

func (*Licenses) ProtoMessage()

func (*Licenses) ProtoReflect

func (x *Licenses) ProtoReflect() protoreflect.Message

func (*Licenses) Reset

func (x *Licenses) Reset()

func (*Licenses) String

func (x *Licenses) String() string

type Result

type Result struct {
	Target            string                             `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
	Vulnerabilities   []*common.Vulnerability            `protobuf:"bytes,2,rep,name=vulnerabilities,proto3" json:"vulnerabilities,omitempty"`
	Misconfigurations []*common.DetectedMisconfiguration `protobuf:"bytes,4,rep,name=misconfigurations,proto3" json:"misconfigurations,omitempty"`
	Class             string                             `protobuf:"bytes,6,opt,name=class,proto3" json:"class,omitempty"`
	Type              string                             `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	Packages          []*common.Package                  `protobuf:"bytes,5,rep,name=packages,proto3" json:"packages,omitempty"`
	CustomResources   []*common.CustomResource           `protobuf:"bytes,7,rep,name=custom_resources,json=customResources,proto3" json:"custom_resources,omitempty"`
	Secrets           []*common.SecretFinding            `protobuf:"bytes,8,rep,name=secrets,proto3" json:"secrets,omitempty"`
	Licenses          []*common.DetectedLicense          `protobuf:"bytes,9,rep,name=licenses,proto3" json:"licenses,omitempty"`
	// contains filtered or unexported fields
}

Result is the same as github.com/aquasecurity/trivy/pkg/report.Result

func (*Result) Descriptor deprecated

func (*Result) Descriptor() ([]byte, []int)

Deprecated: Use Result.ProtoReflect.Descriptor instead.

func (*Result) GetClass

func (x *Result) GetClass() string

func (*Result) GetCustomResources

func (x *Result) GetCustomResources() []*common.CustomResource

func (*Result) GetLicenses

func (x *Result) GetLicenses() []*common.DetectedLicense

func (*Result) GetMisconfigurations

func (x *Result) GetMisconfigurations() []*common.DetectedMisconfiguration

func (*Result) GetPackages

func (x *Result) GetPackages() []*common.Package

func (*Result) GetSecrets

func (x *Result) GetSecrets() []*common.SecretFinding

func (*Result) GetTarget

func (x *Result) GetTarget() string

func (*Result) GetType

func (x *Result) GetType() string

func (*Result) GetVulnerabilities

func (x *Result) GetVulnerabilities() []*common.Vulnerability

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) ProtoReflect

func (x *Result) ProtoReflect() protoreflect.Message

func (*Result) Reset

func (x *Result) Reset()

func (*Result) String

func (x *Result) String() string

type ScanOptions

type ScanOptions struct {
	VulnType          []string             `protobuf:"bytes,1,rep,name=vuln_type,json=vulnType,proto3" json:"vuln_type,omitempty"`
	Scanners          []string             `protobuf:"bytes,2,rep,name=scanners,proto3" json:"scanners,omitempty"`
	ListAllPackages   bool                 `protobuf:"varint,3,opt,name=list_all_packages,json=listAllPackages,proto3" json:"list_all_packages,omitempty"`
	LicenseCategories map[string]*Licenses `` /* 200-byte string literal not displayed */
	IncludeDevDeps    bool                 `protobuf:"varint,5,opt,name=include_dev_deps,json=includeDevDeps,proto3" json:"include_dev_deps,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanOptions) Descriptor deprecated

func (*ScanOptions) Descriptor() ([]byte, []int)

Deprecated: Use ScanOptions.ProtoReflect.Descriptor instead.

func (*ScanOptions) GetIncludeDevDeps

func (x *ScanOptions) GetIncludeDevDeps() bool

func (*ScanOptions) GetLicenseCategories

func (x *ScanOptions) GetLicenseCategories() map[string]*Licenses

func (*ScanOptions) GetListAllPackages

func (x *ScanOptions) GetListAllPackages() bool

func (*ScanOptions) GetScanners

func (x *ScanOptions) GetScanners() []string

func (*ScanOptions) GetVulnType

func (x *ScanOptions) GetVulnType() []string

func (*ScanOptions) ProtoMessage

func (*ScanOptions) ProtoMessage()

func (*ScanOptions) ProtoReflect

func (x *ScanOptions) ProtoReflect() protoreflect.Message

func (*ScanOptions) Reset

func (x *ScanOptions) Reset()

func (*ScanOptions) String

func (x *ScanOptions) String() string

type ScanRequest

type ScanRequest struct {
	Target     string       `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // image name or tar file path
	ArtifactId string       `protobuf:"bytes,2,opt,name=artifact_id,json=artifactId,proto3" json:"artifact_id,omitempty"`
	BlobIds    []string     `protobuf:"bytes,3,rep,name=blob_ids,json=blobIds,proto3" json:"blob_ids,omitempty"`
	Options    *ScanOptions `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanRequest) Descriptor deprecated

func (*ScanRequest) Descriptor() ([]byte, []int)

Deprecated: Use ScanRequest.ProtoReflect.Descriptor instead.

func (*ScanRequest) GetArtifactId

func (x *ScanRequest) GetArtifactId() string

func (*ScanRequest) GetBlobIds

func (x *ScanRequest) GetBlobIds() []string

func (*ScanRequest) GetOptions

func (x *ScanRequest) GetOptions() *ScanOptions

func (*ScanRequest) GetTarget

func (x *ScanRequest) GetTarget() string

func (*ScanRequest) ProtoMessage

func (*ScanRequest) ProtoMessage()

func (*ScanRequest) ProtoReflect

func (x *ScanRequest) ProtoReflect() protoreflect.Message

func (*ScanRequest) Reset

func (x *ScanRequest) Reset()

func (*ScanRequest) String

func (x *ScanRequest) String() string

type ScanResponse

type ScanResponse struct {
	Os      *common.OS `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
	Results []*Result  `protobuf:"bytes,3,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanResponse) Descriptor deprecated

func (*ScanResponse) Descriptor() ([]byte, []int)

Deprecated: Use ScanResponse.ProtoReflect.Descriptor instead.

func (*ScanResponse) GetOs

func (x *ScanResponse) GetOs() *common.OS

func (*ScanResponse) GetResults

func (x *ScanResponse) GetResults() []*Result

func (*ScanResponse) ProtoMessage

func (*ScanResponse) ProtoMessage()

func (*ScanResponse) ProtoReflect

func (x *ScanResponse) ProtoReflect() protoreflect.Message

func (*ScanResponse) Reset

func (x *ScanResponse) Reset()

func (*ScanResponse) String

func (x *ScanResponse) String() string

type Scanner

type Scanner interface {
	Scan(context.Context, *ScanRequest) (*ScanResponse, error)
}

func NewScannerJSONClient

func NewScannerJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scanner

NewScannerJSONClient creates a JSON client that implements the Scanner interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewScannerProtobufClient

func NewScannerProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scanner

NewScannerProtobufClient creates a Protobuf client that implements the Scanner interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewScannerServer

func NewScannerServer(svc Scanner, opts ...interface{}) TwirpServer

NewScannerServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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