rules

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDevelopToolsRules

func DefaultDevelopToolsRules() []security.SecurityRule

DefaultDevelopToolsRules returns the default safe development tool rules.

Types

type FileRuleSource

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

FileRuleSource loads security rules from a file.

func NewFileRuleSource

func NewFileRuleSource(filename string) *FileRuleSource

NewFileRuleSource creates a new FileRuleSource.

func (*FileRuleSource) LoadRules

func (f *FileRuleSource) LoadRules(ctx context.Context) ([]security.SecurityRule, error)

LoadRules loads rules from the configured file.

func (*FileRuleSource) Name

func (f *FileRuleSource) Name() string

Name returns the name of this rule source.

type MemoryRuleSource

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

MemoryRuleSource provides in-memory security rules.

func NewMemoryRuleSource

func NewMemoryRuleSource(name string, rules []security.SecurityRule) *MemoryRuleSource

NewMemoryRuleSource creates a new MemoryRuleSource with the given rules.

func (*MemoryRuleSource) AddRule

func (m *MemoryRuleSource) AddRule(rule security.SecurityRule)

AddRule adds a new rule to the source.

func (*MemoryRuleSource) LoadRules

func (m *MemoryRuleSource) LoadRules(ctx context.Context) ([]security.SecurityRule, error)

LoadRules returns the rules loaded in memory.

func (*MemoryRuleSource) Name

func (m *MemoryRuleSource) Name() string

Name returns the name of this rule source.

type RuleDefinition

type RuleDefinition struct {
	Pattern     string `json:"pattern"`
	Description string `json:"description"`
	Level       string `json:"level"`
	Category    string `json:"category"`
	Type        string `json:"type"` // "danger" or "safe"
}

RuleDefinition represents a rule loaded from a file.

Jump to

Keyboard shortcuts

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