mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
Introduce pluggable analyzer architecture for audit scanning: - Analyzer interface with ID/Scope/Analyze contract - AnalyzeContext union struct carrying inputs for file/skill/bundle scopes - 7 analyzer wrappers: static, dataflow, tier, integrity, structure, markdownLink, cross-skill - Registry with DefaultRegistry(), ForPolicy() filtering, and scope-based accessors (FileAnalyzers/SkillAnalyzers/BundleAnalyzers) - Policy.EnabledAnalyzers allowlist (nil = all enabled, backward compat) - scanSkillImpl refactored to use registry gates for file-scope and iterator loop for skill-scope analyzers - ScanSkillFiltered / ScanSkillFilteredForProject public APIs All existing tests, integration tests, and 60/60 red team assertions pass.
21 lines
607 B
Go
21 lines
607 B
Go
package audit
|
|
|
|
// dataflowAnalyzer wraps taint tracking for shell scripts and markdown code blocks.
|
|
type dataflowAnalyzer struct{}
|
|
|
|
func (a *dataflowAnalyzer) ID() string { return AnalyzerDataflow }
|
|
func (a *dataflowAnalyzer) Scope() AnalyzerScope { return ScopeFile }
|
|
|
|
func (a *dataflowAnalyzer) Analyze(ctx *AnalyzeContext) ([]Finding, error) {
|
|
if ctx.DisabledIDs[patternDataflowTaint] {
|
|
return nil, nil
|
|
}
|
|
if ctx.IsShell {
|
|
return ScanShellDataflow(ctx.Content, ctx.FileName), nil
|
|
}
|
|
if ctx.IsMarkdown {
|
|
return ScanMarkdownDataflow(ctx.Content, ctx.FileName), nil
|
|
}
|
|
return nil, nil
|
|
}
|