Secret scanning
Secret scanning is the process of inspecting source files and configuration for values that resemble credentials. In this course, it uses filesystem traversal and pattern-based rules to detect suspicious values while excluding placeholders and ensuring that reported findings never contain the matched secret.
Minimal example
type Finding struct {
Path string
Line int
RuleName string
}
func Scan(fsys fs.FS) ([]Finding, error) {
var findings []Finding
err := fs.WalkDir(fsys, ".", func(path string, d fs.DirEntry, err error) error {
return err
})
return findings, err
}