plugin

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 17 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)

func NewHclogToJfrogAdapter

func NewHclogToJfrogAdapter() hclog.Logger

NewHclogToJfrogAdapter creates a new adapter that implements hclog.Logger using JFrog's logger

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 HclogToJfrogAdapter

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

HclogToJfrogAdapter adapts hclog.Logger interface to use JFrog's logger

func (*HclogToJfrogAdapter) Debug

func (a *HclogToJfrogAdapter) Debug(msg string, args ...interface{})

Debug implements hclog.Logger.Debug

func (*HclogToJfrogAdapter) Error

func (a *HclogToJfrogAdapter) Error(msg string, args ...interface{})

Error implements hclog.Logger.Error

func (*HclogToJfrogAdapter) GetLevel

func (a *HclogToJfrogAdapter) GetLevel() hclog.Level

GetLevel implements hclog.Logger.GetLevel

func (*HclogToJfrogAdapter) ImpliedArgs

func (a *HclogToJfrogAdapter) ImpliedArgs() []interface{}

ImpliedArgs implements hclog.Logger.ImpliedArgs

func (*HclogToJfrogAdapter) Info

func (a *HclogToJfrogAdapter) Info(msg string, args ...interface{})

Info implements hclog.Logger.Info

func (*HclogToJfrogAdapter) IsDebug

func (a *HclogToJfrogAdapter) IsDebug() bool

IsDebug implements hclog.Logger.IsDebug

func (*HclogToJfrogAdapter) IsError

func (a *HclogToJfrogAdapter) IsError() bool

IsError implements hclog.Logger.IsError

func (*HclogToJfrogAdapter) IsInfo

func (a *HclogToJfrogAdapter) IsInfo() bool

IsInfo implements hclog.Logger.IsInfo

func (*HclogToJfrogAdapter) IsTrace

func (a *HclogToJfrogAdapter) IsTrace() bool

IsTrace implements hclog.Logger.IsTrace

func (*HclogToJfrogAdapter) IsWarn

func (a *HclogToJfrogAdapter) IsWarn() bool

IsWarn implements hclog.Logger.IsWarn

func (*HclogToJfrogAdapter) Log

func (a *HclogToJfrogAdapter) Log(level hclog.Level, msg string, args ...interface{})

Log implements hclog.Logger.Log

func (*HclogToJfrogAdapter) Name

func (a *HclogToJfrogAdapter) Name() string

Name implements hclog.Logger.Name

func (*HclogToJfrogAdapter) Named

func (a *HclogToJfrogAdapter) Named(name string) hclog.Logger

Named implements hclog.Logger.Named

func (*HclogToJfrogAdapter) ResetNamed

func (a *HclogToJfrogAdapter) ResetNamed(name string) hclog.Logger

ResetNamed implements hclog.Logger.ResetNamed

func (*HclogToJfrogAdapter) SetLevel

func (a *HclogToJfrogAdapter) SetLevel(level hclog.Level)

SetLevel implements hclog.Logger.SetLevel

func (*HclogToJfrogAdapter) StandardLogger

func (a *HclogToJfrogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

StandardLogger implements hclog.Logger.StandardLogger

func (*HclogToJfrogAdapter) StandardWriter

func (a *HclogToJfrogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer

StandardWriter implements hclog.Logger.StandardWriter

func (*HclogToJfrogAdapter) Trace

func (a *HclogToJfrogAdapter) Trace(msg string, args ...interface{})

Trace implements hclog.Logger.Trace

func (*HclogToJfrogAdapter) Warn

func (a *HclogToJfrogAdapter) Warn(msg string, args ...interface{})

Warn implements hclog.Logger.Warn

func (*HclogToJfrogAdapter) With

func (a *HclogToJfrogAdapter) With(args ...interface{}) hclog.Logger

With implements hclog.Logger.With

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, err error)

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