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

go
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
}

Learn this concept

Lesson 7.15 · Release checks and gRPC recovery

Used in exercises

Exercise 7.16 · Filesystem secret scanner
Prerequisite conceptsGo testingGitHub Actions