Help us shape the future of Go! Take the 2026 Go Developer Survey

secrets

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintReport

func PrintReport(findings []Finding, opts ReportOptions)

PrintReport prints a human-readable summary of secret findings grouped by file, showing the resource address and attribute that contains each secret.

Types

type Finding

type Finding struct {
	report.Finding

	// ResourceAddress is the Terraform resource address (e.g. "jamfpro_webhook.slack_alerts")
	ResourceAddress string

	// AttrName is the HCL attribute that contains the secret (e.g. "authentication_password")
	AttrName string

	// InSupportFiles is true when the finding is inside support_files/
	InSupportFiles bool

	// SupportFileRef is the .tf file attribute that references this support file
	// via file() (e.g. "support_files/app_configurations/Jamf_Trust.xml")
	SupportFileRef string
}

Finding wraps a gitleaks finding with jamformer-specific metadata.

func Scan

func Scan(dir string, quiet bool) ([]Finding, error)

Scan walks the output directory and returns secret findings enriched with resource address and attribute information. When quiet is true, gitleaks warnings (e.g. "skipping file: too large") are suppressed.

type RemediateResult

type RemediateResult struct {
	VariablesAdded int
	TFFilesChanged int
	SupportFiles   int // support_files converted to templatefile()
	Skipped        int // secrets embedded in larger strings that couldn't be auto-replaced
}

RemediateResult summarises what the remediation changed.

func Remediate

func Remediate(dir string, findings []Finding) (*RemediateResult, error)

Remediate moves detected secrets to sensitive Terraform variables.

For .tf file findings: replaces the literal value with var.<name> and appends the variable declaration + tfvars entry.

For support_files findings: replaces the secret with a template variable, renames the file to .tpl, updates the .tf reference from file() to templatefile(), and creates the variable + tfvars entry.

type ReportOptions

type ReportOptions struct {
	Bold   string
	Dim    string
	Yellow string
	Reset  string
}

ReportOptions controls the formatting of the secret scan report.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL