Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SnippetDetectionEnvVariable = "JFROG_XRAY_SNIPPET_SCAN_ENABLE"

	XrayLibPluginExecutableName = "xray-scan-plugin"
)

Variables

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

Functions

func DownloadXrayLibPluginIfNeeded

func DownloadXrayLibPluginIfNeeded(remoteRepo string, remoteServerDetails *config.ServerDetails) 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" yaml:"bom-ref,omitempty"`
	// The component type of the target ("application" / "library" / "file"...), will be used at the Metadata component.
	Type string `json:"type,omitempty" yaml:"type,omitempty"`
	// The name of the target, will be used at the Metadata component.
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	// [Optional] The logging level for the scan process. if not set will get from environment variable or default to "info".
	LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"`
	// [Optional] The version of the target, will be used at the Metadata component.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
	// [Optional] Patterns (git ignore like) to ignore when scanning the target.
	IgnorePatterns []string `json:"ignorePatterns,omitempty" yaml:"ignorePatterns,omitempty"`
	// [Optional] Ecosystems to scan.
	Ecosystems []techutils.Technology `json:"ecosystems,omitempty" yaml:"ecosystems,omitempty"`
	// [Optional] Specific directories to scan.
	IncludeDirs []string `json:"includeDirs,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, envVars utils.EnvironmentVariables) (scanner Scanner, logPath string, cleanup func(), 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/). The returned cleanup function must be called when the scanner is no longer needed to terminate the plugin subprocess.

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