plugin

package
v1.26.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	XrayLibPluginExecutableName = "xray-scan-plugin"
)

Variables

View Source
var PluginHandshakeConfig = goplugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   xrayLibPluginMagicCookieKey,
	MagicCookieValue: xrayLibMagicCookie,
}

Functions

func DownloadXrayLibPluginIfNeeded

func DownloadXrayLibPluginIfNeeded() error

func GetLocalXrayLibExecutablePath

func GetLocalXrayLibExecutablePath() (xrayLibPath string, err error)

func GetXrayLibPluginDownloadPath

func GetXrayLibPluginDownloadPath() (string, error)

Types

type Config

type Config struct {
	// The BOMRef of the scanned target, will be used at the Metadata and considered the Root.
	BomRef string `json:"bom-ref,omitempty"`
	// The component type of the target ("application" / "library" / "file"...), will be used at the Metadata component.
	Type string `json:"type,omitempty"`
	// The name of the target, will be used at the Metadata component.
	Name string `json:"name,omitempty"`
	// [Optional] The version of the target, will be used at the Metadata component.
	Version string `json:"version,omitempty"`
	// [Optional] Patterns (git ignore like) to ignore when scanning the target.
	IgnorePatterns []string `json:"ignorePatterns,omitempty"`
}

Config holds the configuration for Xray plugin library options.

type Plugin

type Plugin struct {
	goplugin.NetRPCUnsupportedPlugin
	Impl Scanner
}

Implementation of plugin

func (*Plugin) Client

func (p *Plugin) Client(broker *goplugin.MuxBroker, client *rpc.Client) (any, error)

func (*Plugin) Server

func (p *Plugin) Server(broker *goplugin.MuxBroker) (any, error)

type Scanner

type Scanner interface {
	Scan(path string, config Config) (*cyclonedx.BOM, error)
}

func CreateScannerPluginClient

func CreateScannerPluginClient(scangBinary string) (scanner Scanner, logPath string, err error)

CreateScannerPluginClient creates a plugin client. When not in CI and log level is DEBUG, plugin stderr is written to a log file under JFrog home (logs/xrayPluginLogs/)

type ScannerRPCClient

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

func (*ScannerRPCClient) Scan

func (g *ScannerRPCClient) Scan(path string, config Config) (*cyclonedx.BOM, error)

type ScannerRPCScanRequest

type ScannerRPCScanRequest struct {
	Path       string
	ConfigJSON string
}

Plugin Implementation that talks over rpc

type ScannerRPCScanResponse

type ScannerRPCScanResponse struct {
	BOM   *cyclonedx.BOM
	Error error
}

type ScannerRPCServer

type ScannerRPCServer struct {
	Impl Scanner
}

RPC Server that ScanPluginRPC talks to

func (*ScannerRPCServer) Scan

Jump to

Keyboard shortcuts

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