plugins

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureDevOpsArtifact

type AzureDevOpsArtifact struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Path        string `json:"path"`
	Size        int64  `json:"size"`
	ContainerID string `json:"container_id,omitempty"`
}

AzureDevOpsArtifact represents a build artifact

type AzureDevOpsOutput

type AzureDevOpsOutput struct {
	TaskResult     string                     `json:"task_result"`
	ExitCode       int                        `json:"exit_code"`
	Variables      map[string]string          `json:"variables"`
	TestResults    AzureDevOpsTestResults     `json:"test_results"`
	Artifacts      []AzureDevOpsArtifact      `json:"artifacts"`
	WorkItems      []AzureDevOpsWorkItem      `json:"work_items"`
	PRComments     []AzureDevOpsPRComment     `json:"pr_comments"`
	Timeline       []AzureDevOpsTimelineEntry `json:"timeline"`
	Metrics        map[string]interface{}     `json:"metrics"`
	SecurityReport AzureDevOpsSecurityReport  `json:"security_report"`
}

AzureDevOpsOutput represents the output structure for Azure DevOps

type AzureDevOpsPRComment

type AzureDevOpsPRComment struct {
	PRID        int    `json:"pr_id"`
	ThreadID    int    `json:"thread_id,omitempty"`
	Content     string `json:"content"`
	CommentType string `json:"comment_type"`
	Status      string `json:"status"`
}

AzureDevOpsPRComment represents a pull request comment

type AzureDevOpsPlugin

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

AzureDevOpsPlugin implements Plugin interface for Azure DevOps integration

func NewAzureDevOpsPlugin

func NewAzureDevOpsPlugin(logger Logger) *AzureDevOpsPlugin

NewAzureDevOpsPlugin creates a new Azure DevOps plugin instance

func (*AzureDevOpsPlugin) Cleanup

func (p *AzureDevOpsPlugin) Cleanup(ctx context.Context) error

Cleanup performs any necessary cleanup

func (*AzureDevOpsPlugin) Execute

func (p *AzureDevOpsPlugin) Execute(ctx context.Context, result *types.ScanResult) (*PluginResult, error)

Execute runs the Azure DevOps integration

func (*AzureDevOpsPlugin) GetInfo

func (p *AzureDevOpsPlugin) GetInfo() PluginInfo

GetInfo returns plugin information

func (*AzureDevOpsPlugin) GetStatus

func (p *AzureDevOpsPlugin) GetStatus() PluginStatus

GetStatus returns the current plugin status

func (*AzureDevOpsPlugin) Initialize

func (p *AzureDevOpsPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the Azure DevOps plugin

func (*AzureDevOpsPlugin) Validate

func (p *AzureDevOpsPlugin) Validate(ctx context.Context) error

Validate checks if the plugin configuration is valid

type AzureDevOpsSecurityReport

type AzureDevOpsSecurityReport struct {
	Version         string                     `json:"version"`
	Vulnerabilities []AzureDevOpsVulnerability `json:"vulnerabilities"`
	Summary         AzureDevOpsSecuritySummary `json:"summary"`
}

AzureDevOpsSecurityReport represents security report for Azure DevOps

type AzureDevOpsSecuritySummary

type AzureDevOpsSecuritySummary struct {
	Critical int `json:"critical"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Low      int `json:"low"`
	Total    int `json:"total"`
}

AzureDevOpsSecuritySummary represents security summary

type AzureDevOpsSettings

type AzureDevOpsSettings struct {
	Organization       string            `json:"organization"`
	Project            string            `json:"project"`
	Repository         string            `json:"repository"`
	BuildID            string            `json:"build_id"`
	PipelineID         string            `json:"pipeline_id"`
	AccessToken        string            `json:"access_token"`
	FailOnCritical     bool              `json:"fail_on_critical"`
	FailOnHigh         bool              `json:"fail_on_high"`
	CreateWorkItem     bool              `json:"create_work_item"`
	CommentPR          bool              `json:"comment_pr"`
	PublishTestResults bool              `json:"publish_test_results"`
	UploadArtifacts    bool              `json:"upload_artifacts"`
	CustomVariables    map[string]string `json:"custom_variables"`
}

AzureDevOpsSettings contains Azure DevOps specific configuration

type AzureDevOpsTestCase

type AzureDevOpsTestCase struct {
	Name         string `json:"name"`
	Outcome      string `json:"outcome"`
	Duration     int64  `json:"duration_ms"`
	ErrorMessage string `json:"error_message,omitempty"`
	StackTrace   string `json:"stack_trace,omitempty"`
}

AzureDevOpsTestCase represents a test case

type AzureDevOpsTestResults

type AzureDevOpsTestResults struct {
	TestRun      string                `json:"test_run"`
	TotalTests   int                   `json:"total_tests"`
	PassedTests  int                   `json:"passed_tests"`
	FailedTests  int                   `json:"failed_tests"`
	SkippedTests int                   `json:"skipped_tests"`
	TestCases    []AzureDevOpsTestCase `json:"test_cases"`
}

AzureDevOpsTestResults represents Azure DevOps test results

type AzureDevOpsTimelineEntry

type AzureDevOpsTimelineEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Event     string    `json:"event"`
	Message   string    `json:"message"`
	Level     string    `json:"level"`
}

AzureDevOpsTimelineEntry represents a timeline entry

type AzureDevOpsVulnerability

type AzureDevOpsVulnerability struct {
	ID          string                 `json:"id"`
	Category    string                 `json:"category"`
	Title       string                 `json:"title"`
	Description string                 `json:"description"`
	Severity    string                 `json:"severity"`
	Confidence  string                 `json:"confidence"`
	Location    map[string]interface{} `json:"location"`
	References  []string               `json:"references"`
}

AzureDevOpsVulnerability represents a vulnerability

type AzureDevOpsWorkItem

type AzureDevOpsWorkItem struct {
	ID          int               `json:"id,omitempty"`
	Type        string            `json:"type"`
	Title       string            `json:"title"`
	Description string            `json:"description"`
	State       string            `json:"state"`
	Priority    string            `json:"priority"`
	Severity    string            `json:"severity"`
	Tags        []string          `json:"tags"`
	Fields      map[string]string `json:"fields"`
}

AzureDevOpsWorkItem represents a work item

type CircleCIArtifact

type CircleCIArtifact struct {
	Path        string `json:"path"`
	Destination string `json:"destination"`
	Size        int64  `json:"size"`
	Type        string `json:"type"`
}

CircleCIArtifact represents a CircleCI artifact

type CircleCIInsights

type CircleCIInsights struct {
	SecurityScore   float64                `json:"security_score"`
	TrendData       []CircleCITrendPoint   `json:"trend_data"`
	Recommendations []string               `json:"recommendations"`
	Metrics         map[string]interface{} `json:"metrics"`
}

CircleCIInsights represents CircleCI insights data

type CircleCINotification

type CircleCINotification struct {
	Type    string                 `json:"type"`
	Target  string                 `json:"target"`
	Message string                 `json:"message"`
	Data    map[string]interface{} `json:"data"`
	Sent    bool                   `json:"sent"`
}

CircleCINotification represents a notification

type CircleCIOutput

type CircleCIOutput struct {
	JobStatus       string                 `json:"job_status"`
	ExitCode        int                    `json:"exit_code"`
	EnvironmentVars map[string]string      `json:"environment_vars"`
	Artifacts       []CircleCIArtifact     `json:"artifacts"`
	TestResults     CircleCITestResults    `json:"test_results"`
	Steps           []CircleCIStep         `json:"steps"`
	Notifications   []CircleCINotification `json:"notifications"`
	Metrics         map[string]interface{} `json:"metrics"`
	Insights        CircleCIInsights       `json:"insights"`
}

CircleCIOutput represents the output structure for CircleCI

type CircleCIPlugin

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

CircleCIPlugin implements Plugin interface for CircleCI integration

func NewCircleCIPlugin

func NewCircleCIPlugin(logger Logger) *CircleCIPlugin

NewCircleCIPlugin creates a new CircleCI plugin instance

func (*CircleCIPlugin) Cleanup

func (p *CircleCIPlugin) Cleanup(ctx context.Context) error

Cleanup performs any necessary cleanup

func (*CircleCIPlugin) Execute

func (p *CircleCIPlugin) Execute(ctx context.Context, result *types.ScanResult) (*PluginResult, error)

Execute runs the CircleCI integration

func (*CircleCIPlugin) GetInfo

func (p *CircleCIPlugin) GetInfo() PluginInfo

GetInfo returns plugin information

func (*CircleCIPlugin) GetStatus

func (p *CircleCIPlugin) GetStatus() PluginStatus

GetStatus returns the current plugin status

func (*CircleCIPlugin) Initialize

func (p *CircleCIPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the CircleCI plugin

func (*CircleCIPlugin) Validate

func (p *CircleCIPlugin) Validate(ctx context.Context) error

Validate checks if the plugin configuration is valid

type CircleCISettings

type CircleCISettings struct {
	ProjectSlug      string            `json:"project_slug"`
	WorkflowID       string            `json:"workflow_id"`
	JobNumber        string            `json:"job_number"`
	BuildNumber      string            `json:"build_number"`
	APIToken         string            `json:"api_token"`
	FailOnCritical   bool              `json:"fail_on_critical"`
	FailOnHigh       bool              `json:"fail_on_high"`
	StoreArtifacts   bool              `json:"store_artifacts"`
	StoreTestResults bool              `json:"store_test_results"`
	NotifySlack      bool              `json:"notify_slack"`
	SlackWebhook     string            `json:"slack_webhook"`
	CustomEnvVars    map[string]string `json:"custom_env_vars"`
}

CircleCISettings contains CircleCI specific configuration

type CircleCIStep

type CircleCIStep struct {
	Name     string                 `json:"name"`
	Command  string                 `json:"command"`
	ExitCode int                    `json:"exit_code"`
	Duration int64                  `json:"duration_ms"`
	Output   string                 `json:"output"`
	Status   string                 `json:"status"`
	Metadata map[string]interface{} `json:"metadata"`
}

CircleCIStep represents a CircleCI step

type CircleCITestCase

type CircleCITestCase struct {
	Classname string  `json:"classname"`
	Name      string  `json:"name"`
	Time      float64 `json:"time"`
	Failure   string  `json:"failure,omitempty"`
	Error     string  `json:"error,omitempty"`
	SystemOut string  `json:"system-out,omitempty"`
	SystemErr string  `json:"system-err,omitempty"`
}

CircleCITestCase represents a test case

type CircleCITestResults

type CircleCITestResults struct {
	Path         string             `json:"path"`
	Format       string             `json:"format"`
	TotalTests   int                `json:"total_tests"`
	PassedTests  int                `json:"passed_tests"`
	FailedTests  int                `json:"failed_tests"`
	SkippedTests int                `json:"skipped_tests"`
	TestCases    []CircleCITestCase `json:"test_cases"`
}

CircleCITestResults represents CircleCI test results

type CircleCITrendPoint

type CircleCITrendPoint struct {
	Timestamp   time.Time `json:"timestamp"`
	RiskScore   float64   `json:"risk_score"`
	ThreatCount int       `json:"threat_count"`
	BuildNumber string    `json:"build_number"`
}

CircleCITrendPoint represents a trend data point

type GitHubActionsOutput

type GitHubActionsOutput struct {
	Summary         string                 `json:"summary"`
	CriticalCount   int                    `json:"critical_count"`
	HighCount       int                    `json:"high_count"`
	MediumCount     int                    `json:"medium_count"`
	LowCount        int                    `json:"low_count"`
	TotalPackages   int                    `json:"total_packages"`
	BlockedPackages []string               `json:"blocked_packages"`
	Recommendations []string               `json:"recommendations"`
	Details         map[string]interface{} `json:"details"`
	ExitCode        int                    `json:"exit_code"`
}

GitHubActionsOutput represents the output format for GitHub Actions

type GitHubActionsPlugin

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

GitHubActionsPlugin implements CI/CD integration for GitHub Actions

func NewGitHubActionsPlugin

func NewGitHubActionsPlugin(config map[string]interface{}, logger Logger) *GitHubActionsPlugin

NewGitHubActionsPlugin creates a new GitHub Actions plugin

func (*GitHubActionsPlugin) Cleanup

func (ga *GitHubActionsPlugin) Cleanup(ctx context.Context) error

Cleanup performs plugin cleanup

func (*GitHubActionsPlugin) Execute

func (ga *GitHubActionsPlugin) Execute(ctx context.Context, results *types.ScanResult) (*PluginResult, error)

Execute runs the plugin with scan results

func (*GitHubActionsPlugin) GetInfo

func (ga *GitHubActionsPlugin) GetInfo() PluginInfo

GetInfo returns plugin metadata

func (*GitHubActionsPlugin) GetStatus

func (ga *GitHubActionsPlugin) GetStatus() PluginStatus

GetStatus returns current plugin status

func (*GitHubActionsPlugin) Initialize

func (ga *GitHubActionsPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the plugin

func (*GitHubActionsPlugin) Validate

func (ga *GitHubActionsPlugin) Validate(ctx context.Context) error

Validate checks if the plugin can run in the current environment

type GitHubActionsSettings

type GitHubActionsSettings struct {
	Token              string             `json:"token"`
	Repository         string             `json:"repository"`
	FailOnCritical     bool               `json:"fail_on_critical"`
	FailOnHigh         bool               `json:"fail_on_high"`
	CreateIssues       bool               `json:"create_issues"`
	CommentOnPR        bool               `json:"comment_on_pr"`
	BlockedPackages    []string           `json:"blocked_packages"`
	AllowedPackages    []string           `json:"allowed_packages"`
	NotificationUsers  []string           `json:"notification_users"`
	CustomLabels       []string           `json:"custom_labels"`
	SeverityThresholds map[string]float64 `json:"severity_thresholds"`
}

GitHubActionsSettings contains GitHub Actions specific configuration

type GitLabCIAnnotation

type GitLabCIAnnotation struct {
	Level       string `json:"level"`
	Message     string `json:"message"`
	Path        string `json:"path,omitempty"`
	StartLine   int    `json:"start_line,omitempty"`
	EndLine     int    `json:"end_line,omitempty"`
	StartColumn int    `json:"start_column,omitempty"`
	EndColumn   int    `json:"end_column,omitempty"`
}

GitLabCIAnnotation represents a GitLab CI annotation

type GitLabCIOutput

type GitLabCIOutput struct {
	JobStatus   string                 `json:"job_status"`
	ExitCode    int                    `json:"exit_code"`
	Variables   map[string]string      `json:"variables"`
	Artifacts   []string               `json:"artifacts"`
	Annotations []GitLabCIAnnotation   `json:"annotations"`
	Metrics     map[string]interface{} `json:"metrics"`
	Reports     GitLabCIReports        `json:"reports"`
}

GitLabCIOutput represents the output structure for GitLab CI

type GitLabCIPlugin

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

GitLabCIPlugin implements Plugin interface for GitLab CI integration

func NewGitLabCIPlugin

func NewGitLabCIPlugin(logger Logger) *GitLabCIPlugin

NewGitLabCIPlugin creates a new GitLab CI plugin instance

func (*GitLabCIPlugin) Cleanup

func (p *GitLabCIPlugin) Cleanup(ctx context.Context) error

Cleanup performs any necessary cleanup

func (*GitLabCIPlugin) Execute

func (p *GitLabCIPlugin) Execute(ctx context.Context, result *types.ScanResult) (*PluginResult, error)

Execute runs the GitLab CI integration

func (*GitLabCIPlugin) GetInfo

func (p *GitLabCIPlugin) GetInfo() PluginInfo

GetInfo returns plugin information

func (*GitLabCIPlugin) GetStatus

func (p *GitLabCIPlugin) GetStatus() PluginStatus

GetStatus returns the current plugin status

func (*GitLabCIPlugin) Initialize

func (p *GitLabCIPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the GitLab CI plugin

func (*GitLabCIPlugin) Validate

func (p *GitLabCIPlugin) Validate(ctx context.Context) error

Validate checks if the plugin configuration is valid

type GitLabCIReports

type GitLabCIReports struct {
	SecurityReport map[string]interface{} `json:"security_report,omitempty"`
	CodeQuality    []interface{}          `json:"code_quality,omitempty"`
	Junit          string                 `json:"junit,omitempty"`
}

GitLabCIReports represents GitLab CI reports

type GitLabCISettings

type GitLabCISettings struct {
	ProjectID       string            `json:"project_id"`
	Token           string            `json:"token"`
	PipelineID      string            `json:"pipeline_id"`
	JobID           string            `json:"job_id"`
	Environment     string            `json:"environment"`
	FailOnCritical  bool              `json:"fail_on_critical"`
	FailOnHigh      bool              `json:"fail_on_high"`
	CreateIssue     bool              `json:"create_issue"`
	NotifyMR        bool              `json:"notify_mr"`
	CustomVariables map[string]string `json:"custom_variables"`
}

GitLabCISettings contains GitLab CI specific configuration

type JenkinsArtifact

type JenkinsArtifact struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Size        int64  `json:"size"`
	Fingerprint string `json:"fingerprint,omitempty"`
}

JenkinsArtifact represents a Jenkins build artifact

type JenkinsNotification

type JenkinsNotification struct {
	Type       string   `json:"type"`
	Recipients []string `json:"recipients"`
	Subject    string   `json:"subject"`
	Message    string   `json:"message"`
	Sent       bool     `json:"sent"`
}

JenkinsNotification represents a notification

type JenkinsOutput

type JenkinsOutput struct {
	BuildResult      string                 `json:"build_result"`
	ExitCode         int                    `json:"exit_code"`
	Properties       map[string]string      `json:"properties"`
	Artifacts        []JenkinsArtifact      `json:"artifacts"`
	TestResults      JenkinsTestResults     `json:"test_results"`
	PublishedReports []JenkinsReport        `json:"published_reports"`
	Notifications    []JenkinsNotification  `json:"notifications"`
	Metrics          map[string]interface{} `json:"metrics"`
}

JenkinsOutput represents the output structure for Jenkins

type JenkinsPlugin

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

JenkinsPlugin implements Plugin interface for Jenkins integration

func NewJenkinsPlugin

func NewJenkinsPlugin(logger Logger) *JenkinsPlugin

NewJenkinsPlugin creates a new Jenkins plugin instance

func (*JenkinsPlugin) Cleanup

func (p *JenkinsPlugin) Cleanup(ctx context.Context) error

Cleanup performs any necessary cleanup

func (*JenkinsPlugin) Execute

func (p *JenkinsPlugin) Execute(ctx context.Context, result *types.ScanResult) (*PluginResult, error)

Execute runs the Jenkins integration

func (*JenkinsPlugin) GetInfo

func (p *JenkinsPlugin) GetInfo() PluginInfo

GetInfo returns plugin information

func (*JenkinsPlugin) GetStatus

func (p *JenkinsPlugin) GetStatus() PluginStatus

GetStatus returns the current plugin status

func (*JenkinsPlugin) Initialize

func (p *JenkinsPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the Jenkins plugin

func (*JenkinsPlugin) Validate

func (p *JenkinsPlugin) Validate(ctx context.Context) error

Validate checks if the plugin configuration is valid

type JenkinsReport

type JenkinsReport struct {
	Type        string `json:"type"`
	Title       string `json:"title"`
	Path        string `json:"path"`
	Description string `json:"description"`
}

JenkinsReport represents a published report

type JenkinsSettings

type JenkinsSettings struct {
	JenkinsURL       string            `json:"jenkins_url"`
	JobName          string            `json:"job_name"`
	BuildNumber      string            `json:"build_number"`
	Workspace        string            `json:"workspace"`
	CredentialsID    string            `json:"credentials_id"`
	FailOnCritical   bool              `json:"fail_on_critical"`
	FailOnHigh       bool              `json:"fail_on_high"`
	PublishResults   bool              `json:"publish_results"`
	ArchiveReports   bool              `json:"archive_reports"`
	NotifyEmail      bool              `json:"notify_email"`
	EmailRecipients  []string          `json:"email_recipients"`
	CustomProperties map[string]string `json:"custom_properties"`
}

JenkinsSettings contains Jenkins specific configuration

type JenkinsTestResults

type JenkinsTestResults struct {
	TotalTests   int `json:"total_tests"`
	PassedTests  int `json:"passed_tests"`
	FailedTests  int `json:"failed_tests"`
	SkippedTests int `json:"skipped_tests"`
}

JenkinsTestResults represents Jenkins test results

type Logger

type Logger interface {
	Debug(msg string, args ...interface{})
	Info(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Error(msg string, args ...interface{})
}

Logger interface for plugin logging

type Plugin

type Plugin interface {
	// GetInfo returns plugin metadata
	GetInfo() PluginInfo

	// Initialize sets up the plugin
	Initialize(ctx context.Context, config map[string]interface{}) error

	// Execute runs the plugin with scan results
	Execute(ctx context.Context, results *types.ScanResult) (*PluginResult, error)

	// Validate checks if the plugin can run in the current environment
	Validate(ctx context.Context) error

	// Cleanup performs plugin cleanup
	Cleanup(ctx context.Context) error

	// GetStatus returns current plugin status
	GetStatus() PluginStatus
}

Plugin represents a CI/CD integration plugin

type PluginAction

type PluginAction struct {
	Type        string                 `json:"type"` // "block", "warn", "notify", "report"
	Target      string                 `json:"target"`
	Description string                 `json:"description"`
	Data        map[string]interface{} `json:"data,omitempty"`
	Metadata    map[string]interface{} `json:"metadata"`
	Timestamp   time.Time              `json:"timestamp"`
}

PluginAction represents an action taken by the plugin

type PluginFactory

type PluginFactory func(config map[string]interface{}) (Plugin, error)

PluginFactory creates plugin instances

type PluginInfo

type PluginInfo struct {
	Name         string                 `json:"name"`
	Version      string                 `json:"version"`
	Description  string                 `json:"description"`
	Author       string                 `json:"author"`
	Platform     string                 `json:"platform"` // github-actions, gitlab-ci, jenkins, etc.
	Capabilities []string               `json:"capabilities"`
	Requirements map[string]string      `json:"requirements"`
	ConfigSchema map[string]interface{} `json:"config_schema"`
}

PluginInfo contains plugin metadata

type PluginManager

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

PluginManager manages CI/CD platform plugins

func NewPluginManager

func NewPluginManager(config *config.Config, logger Logger) *PluginManager

NewPluginManager creates a new plugin manager

func (*PluginManager) ExecutePlugins

func (pm *PluginManager) ExecutePlugins(ctx context.Context, results *types.ScanResult) ([]PluginResult, error)

ExecutePlugins executes all active plugins with scan results

func (*PluginManager) GetPlugin

func (pm *PluginManager) GetPlugin(name string) (Plugin, error)

GetPlugin returns a specific plugin by name

func (*PluginManager) GetPluginStatus

func (pm *PluginManager) GetPluginStatus() map[string]PluginStatus

GetPluginStatus returns the status of all plugins

func (*PluginManager) Initialize

func (pm *PluginManager) Initialize(ctx context.Context) error

Initialize sets up the plugin manager

func (*PluginManager) ListPlugins

func (pm *PluginManager) ListPlugins() map[string]PluginInfo

ListPlugins returns information about all loaded plugins

func (*PluginManager) LoadPlugin

func (pm *PluginManager) LoadPlugin(ctx context.Context, name, platform string, config map[string]interface{}) error

LoadPlugin loads and initializes a specific plugin

func (*PluginManager) RegisterPlugin

func (pm *PluginManager) RegisterPlugin(platform string, factory PluginFactory) error

RegisterPlugin registers a new plugin type

func (*PluginManager) Shutdown

func (pm *PluginManager) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down all plugins

func (*PluginManager) UnloadPlugin

func (pm *PluginManager) UnloadPlugin(ctx context.Context, name string) error

UnloadPlugin unloads a specific plugin

type PluginResult

type PluginResult struct {
	Success  bool                   `json:"success"`
	Message  string                 `json:"message"`
	Actions  []PluginAction         `json:"actions"`
	Metrics  map[string]interface{} `json:"metrics"`
	Duration time.Duration          `json:"duration"`
	Data     map[string]interface{} `json:"data,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Error    error                  `json:"error,omitempty"`
}

PluginResult represents the result of plugin execution

type PluginStatus

type PluginStatus struct {
	State       string    `json:"state"` // "active", "inactive", "error", "disabled"
	LastRun     time.Time `json:"last_run"`
	RunCount    int       `json:"run_count"`
	ErrorCount  int       `json:"error_count"`
	LastError   string    `json:"last_error,omitempty"`
	HealthCheck bool      `json:"health_check"`
}

PluginStatus represents plugin status

type WebhookOutput

type WebhookOutput struct {
	RequestID       string                 `json:"request_id"`
	URL             string                 `json:"url"`
	Method          string                 `json:"method"`
	StatusCode      int                    `json:"status_code"`
	ResponseTime    int64                  `json:"response_time_ms"`
	RequestHeaders  map[string]string      `json:"request_headers"`
	ResponseHeaders map[string]string      `json:"response_headers"`
	RequestBody     interface{}            `json:"request_body"`
	ResponseBody    string                 `json:"response_body"`
	Success         bool                   `json:"success"`
	Error           string                 `json:"error,omitempty"`
	RetryAttempts   int                    `json:"retry_attempts"`
	Metrics         map[string]interface{} `json:"metrics"`
}

WebhookOutput represents the output structure for webhook

type WebhookPayload

type WebhookPayload struct {
	Event           string                 `json:"event"`
	Timestamp       time.Time              `json:"timestamp"`
	Source          string                 `json:"source"`
	Version         string                 `json:"version"`
	PackageName     string                 `json:"package_name"`
	PackageVersion  string                 `json:"package_version"`
	RiskScore       float64                `json:"risk_score"`
	OverallRisk     string                 `json:"overall_risk"`
	Threats         []WebhookThreat        `json:"threats"`
	Recommendations []string               `json:"recommendations"`
	Metadata        map[string]interface{} `json:"metadata"`
	CustomData      map[string]interface{} `json:"custom_data,omitempty"`
}

WebhookPayload represents the standard webhook payload

type WebhookPlugin

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

WebhookPlugin implements Plugin interface for generic webhook integration

func NewWebhookPlugin

func NewWebhookPlugin(logger Logger) *WebhookPlugin

NewWebhookPlugin creates a new webhook plugin instance

func (*WebhookPlugin) Cleanup

func (p *WebhookPlugin) Cleanup(ctx context.Context) error

Cleanup performs any necessary cleanup

func (*WebhookPlugin) Execute

func (p *WebhookPlugin) Execute(ctx context.Context, result *types.ScanResult) (*PluginResult, error)

Execute runs the webhook integration

func (*WebhookPlugin) GetInfo

func (p *WebhookPlugin) GetInfo() PluginInfo

GetInfo returns plugin information

func (*WebhookPlugin) GetStatus

func (p *WebhookPlugin) GetStatus() PluginStatus

GetStatus returns the current plugin status

func (*WebhookPlugin) Initialize

func (p *WebhookPlugin) Initialize(ctx context.Context, config map[string]interface{}) error

Initialize sets up the webhook plugin

func (*WebhookPlugin) Validate

func (p *WebhookPlugin) Validate(ctx context.Context) error

Validate checks if the plugin configuration is valid

type WebhookResponse

type WebhookResponse struct {
	Success   bool                   `json:"success"`
	Message   string                 `json:"message"`
	RequestID string                 `json:"request_id,omitempty"`
	Actions   []string               `json:"actions,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

WebhookResponse represents the response from webhook endpoint

type WebhookSettings

type WebhookSettings struct {
	URL             string                 `json:"url"`
	Method          string                 `json:"method"`
	Headers         map[string]string      `json:"headers"`
	Secret          string                 `json:"secret"`
	SignatureHeader string                 `json:"signature_header"`
	ContentType     string                 `json:"content_type"`
	Timeout         int                    `json:"timeout_seconds"`
	RetryAttempts   int                    `json:"retry_attempts"`
	RetryDelay      int                    `json:"retry_delay_seconds"`
	FailOnCritical  bool                   `json:"fail_on_critical"`
	FailOnHigh      bool                   `json:"fail_on_high"`
	FilterSeverity  []string               `json:"filter_severity"`
	CustomPayload   map[string]interface{} `json:"custom_payload"`
	AuthType        string                 `json:"auth_type"`
	AuthToken       string                 `json:"auth_token"`
	Username        string                 `json:"username"`
	Password        string                 `json:"password"`
}

WebhookSettings contains webhook specific configuration

type WebhookThreat

type WebhookThreat struct {
	Type        string  `json:"type"`
	Severity    string  `json:"severity"`
	Description string  `json:"description"`
	Score       float64 `json:"score"`
	Confidence  float64 `json:"confidence"`
}

WebhookThreat represents a threat in the webhook payload

Jump to

Keyboard shortcuts

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