trustguard

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "trustguard"

Variables

This section is empty.

Functions

This section is empty.

Types

type GuardAttachment

type GuardAttachment struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	Data        string `json:"data,omitempty"`
	URL         string `json:"url,omitempty"`
}

type GuardAttributes

type GuardAttributes struct {
	ContentType string     `json:"content_type"`
	Model       GuardModel `json:"model"`
}

type GuardFinding

type GuardFinding struct {
	DetectionType string  `json:"detection_type,omitempty"`
	Confidence    float64 `json:"confidence,omitempty"`
	RuleName      string  `json:"rule_name,omitempty"`
	Status        string  `json:"status,omitempty"`
	PolicyID      string  `json:"policy_id,omitempty"`
	DetectorID    string  `json:"detector_id,omitempty"`
	Action        string  `json:"action,omitempty"`
	Details       any     `json:"details,omitempty"`
}

type GuardInput

type GuardInput struct {
	Input       string            `json:"input"`
	Attachments []GuardAttachment `json:"attachments,omitempty"`
}

type GuardModel

type GuardModel struct {
	Name     string `json:"name,omitempty"`
	Provider string `json:"provider,omitempty"`
}

type GuardRequest

type GuardRequest struct {
	Input      GuardInput      `json:"input"`
	Direction  string          `json:"direction"`
	Protocol   string          `json:"protocol"`
	GatewayID  string          `json:"gateway_id"`
	SessionID  string          `json:"session_id"`
	ConsumerID string          `json:"consumer_id"`
	Attributes GuardAttributes `json:"attributes"`
}

type GuardResponse

type GuardResponse struct {
	Status             string         `json:"status"`
	TransformedPayload map[string]any `json:"transformed_payload"`
	Findings           []GuardFinding `json:"findings"`
	TraceID            string         `json:"trace_id"`
	RequestID          string         `json:"request_id"`
}

type Plugin

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

func New

func New(registry *adapter.Registry, baseURL string, timeout time.Duration, clientID, clientSecret string, logger *slog.Logger) *Plugin

func (*Plugin) Execute

func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) MutatesMetadata

func (p *Plugin) MutatesMetadata() bool

func (*Plugin) MutatesRequestBody

func (p *Plugin) MutatesRequestBody() bool

func (*Plugin) MutatesResponseBody

func (p *Plugin) MutatesResponseBody() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

type Settings

type Settings struct {
	Inspect string `mapstructure:"inspect"`
	BaseURL string `mapstructure:"base_url"`
}

Jump to

Keyboard shortcuts

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