Documentation
¶
Overview ¶
Package skill provides core skill manipulation and security checking logic.
Package skill provides core skill manipulation, validation, and security checking logic.
Index ¶
- func CalculateEntropy(s string) float64
- func CreateSkillTemplate(name, destDir string) error
- func FindSkillMD(skillPath string) bool
- func GenerateReport(result *CheckResult, format string) (string, error)
- func GenerateSARIFReport(result *CheckResult, version string) (string, error)
- type CheckResult
- type Finding
- type Meta
- type Rule
- type SARIFArtifactLocation
- type SARIFDriver
- type SARIFLocation
- type SARIFMessage
- type SARIFPhysicalLocation
- type SARIFRegion
- type SARIFReport
- type SARIFResult
- type SARIFRule
- type SARIFRuleConfig
- type SARIFRun
- type SARIFTool
- type ScanResult
- type Severity
- type TemplateData
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateEntropy ¶ added in v1.0.0
CalculateEntropy calculates the Shannon entropy of a string. Higher entropy indicates more randomness, which is common in secrets/keys.
func CreateSkillTemplate ¶ added in v0.2.0
CreateSkillTemplate creates a new skill directory with template files
func FindSkillMD ¶
FindSkillMD checks if a skill has a SKILL.md file
func GenerateReport ¶ added in v1.0.0
func GenerateReport(result *CheckResult, format string) (string, error)
GenerateReport generates a report in the specified format ("md", "html", or "json")
func GenerateSARIFReport ¶ added in v1.7.5
func GenerateSARIFReport(result *CheckResult, version string) (string, error)
GenerateSARIFReport generates a SARIF v2.1.0 formatted security report
Types ¶
type CheckResult ¶ added in v1.0.0
type CheckResult struct {
SkillName string
Findings []Finding
ScannedModules []string // List of all modules scanned, including clean ones
}
CheckResult contains all findings for a skill
func CheckSafety ¶ added in v1.0.0
func CheckSafety(skillPath string) (*CheckResult, error)
CheckSafety performs security checks on a skill directory
type Finding ¶ added in v1.0.0
type Finding struct {
RuleID string
Severity Severity
Description string
Module string // The skill or module name where this finding occurred
File string
Line int
Match string
}
Finding represents a single security issue found in a skill
type Meta ¶ added in v1.0.0
type Meta struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Version string `yaml:"version"`
Author string `yaml:"author"`
Dependencies []string `yaml:"dependencies"`
Tags []string `yaml:"tags"`
License string `yaml:"license"`
Compatibility string `yaml:"compatibility"`
Metadata map[string]string `yaml:"metadata"`
AllowedTools []string `yaml:"allowed-tools"`
}
Meta represents metadata parsed from SKILL.md
func ParseSkillMD ¶
ParseSkillMD parses a SKILL.md file and extracts frontmatter metadata
type Rule ¶ added in v1.0.0
type Rule struct {
ID string
Description string
Severity Severity
Regex *regexp.Regexp
Entropy float64 // Minimum entropy threshold (0 to ignore)
Tags []string
}
Rule represents a security check rule
type SARIFArtifactLocation ¶ added in v1.7.5
type SARIFArtifactLocation struct {
URI string `json:"uri"`
}
type SARIFDriver ¶ added in v1.7.5
type SARIFLocation ¶ added in v1.7.5
type SARIFLocation struct {
PhysicalLocation SARIFPhysicalLocation `json:"physicalLocation"`
}
type SARIFMessage ¶ added in v1.7.5
type SARIFMessage struct {
Text string `json:"text"`
}
type SARIFPhysicalLocation ¶ added in v1.7.5
type SARIFPhysicalLocation struct {
ArtifactLocation SARIFArtifactLocation `json:"artifactLocation"`
Region *SARIFRegion `json:"region,omitempty"`
}
type SARIFRegion ¶ added in v1.7.5
type SARIFRegion struct {
StartLine int `json:"startLine"`
}
type SARIFReport ¶ added in v1.7.5
type SARIFReport struct {
Schema string `json:"$schema"`
Version string `json:"version"`
Runs []SARIFRun `json:"runs"`
}
SARIFReport represents a SARIF v2.1.0 report
type SARIFResult ¶ added in v1.7.5
type SARIFResult struct {
RuleID string `json:"ruleId"`
Level string `json:"level"`
Message SARIFMessage `json:"message"`
Locations []SARIFLocation `json:"locations,omitempty"`
}
type SARIFRule ¶ added in v1.7.5
type SARIFRule struct {
ID string `json:"id"`
ShortDescription SARIFMessage `json:"shortDescription"`
DefaultConfig SARIFRuleConfig `json:"defaultConfiguration"`
}
type SARIFRuleConfig ¶ added in v1.7.5
type SARIFRuleConfig struct {
Level string `json:"level"`
}
type SARIFRun ¶ added in v1.7.5
type SARIFRun struct {
Tool SARIFTool `json:"tool"`
Results []SARIFResult `json:"results"`
}
type SARIFTool ¶ added in v1.7.5
type SARIFTool struct {
Driver SARIFDriver `json:"driver"`
}
type ScanResult ¶ added in v1.5.1
ScanResult represents a found skill on disk
func ScanDirectory ¶ added in v1.5.1
func ScanDirectory(root string, limitDepth int) ([]ScanResult, error)
ScanDirectory recursively scans a directory for skills (directories containing SKILL.md) limitDepth prevents infinite recursion. Default recommendation: 3-5
type Severity ¶ added in v1.0.0
type Severity string
Severity represents the severity of a security finding
type TemplateData ¶ added in v1.0.0
TemplateData holds data for the skill template
type ValidationError ¶ added in v1.6.0
ValidationError represents a validation issue with a SKILL.md file
func ValidateMeta ¶ added in v1.6.0
func ValidateMeta(meta *Meta, dirName string) []ValidationError
ValidateMeta validates the Meta struct against the Agent Skills specification https://agentskills.io/specification