Go Analyzer (Scanner)

What it does

Inputs and precedence

The analyzer processes inputs in the following order, with binary evidence taking precedence:

  1. Binary inventory (Phase 1, authoritative): Extract embedded build info (runtime/debug buildinfo blob) and emit Go modules (main + deps) with concrete versions and build settings evidence. Binary-derived components include provenance=binary metadata.
  2. Source inventory (Phase 2, supplementary): Parse go.mod, go.sum, go.work, and vendor/modules.txt to emit modules not already covered by binary evidence. Source-derived components include provenance=source metadata.
  3. Heuristic fallback (stripped binaries): When buildinfo is missing, emit deterministic bin components keyed by sha256 plus minimal classification evidence.

Precedence rules:

Project discovery (modules + workspaces)

Workspace replace directive propagation

go.work files may contain replace directives that apply to all workspace members:

Identity rules (PURL vs explicit key)

Concrete versions emit a PURL:

Non-concrete identities emit an explicit key:

Evidence and metadata

Binary-derived components

Binary components include (when present):

Source-derived components

Source components include:

Heuristic fallback components

Fallback components include:

Capability scanning

The analyzer detects security-relevant capabilities in Go source code:

CapabilityRiskExamples
ExecCriticalexec.Command, syscall.Exec, os.StartProcess
NativeCodeCriticalunsafe.Pointer, //go:linkname, syscall.Syscall
PluginLoadingCriticalplugin.Open
FilesystemHigh/Mediumos.Remove, os.Chmod, os.WriteFile
NetworkMediumnet.Dial, http.Get, http.ListenAndServe
EnvironmentHigh/Mediumos.Setenv, os.Getenv
DatabaseMediumsql.Open, db.Query
DynamicCodeHighreflect.Value.Call, template.Execute
SerializationMediumgob.NewDecoder, xml.Unmarshal
ReflectionLow/Mediumreflect.TypeOf, reflect.New
CryptoLowHash functions, cipher operations

Capabilities are emitted as:

IO/Memory bounds

Binary and DWARF scanning uses bounded windowed reads to limit memory usage:

Retract semantics

Go’s retract directive only applies to versions of the declaring module itself, not to dependencies:

Cache key correctness

Binary build info is cached using a composite key:

The header hash ensures correct behavior in containerized/layered filesystem environments where files may have identical metadata but different content.

References