secrets

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package secrets provides a lightweight, dependency-free scanner for high-confidence secret patterns (cloud keys, provider tokens, private keys, JWTs). It complements the boundary scrubbing of the configured API key by catching OTHER secrets that a command or diff happens to print, so they are not echoed back into the model context. It deliberately favors precision over recall: only well-shaped, distinctive patterns match, to avoid false positives on ordinary output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Type  string // category, e.g. "aws_access_key_id"
	Match string // the exact matched text (used for redaction)
}

Finding is one detected secret occurrence.

func Redact

func Redact(text string) (string, []Finding)

Redact replaces every detected secret in text with a typed placeholder and returns the redacted text plus the findings. When nothing matches it returns the input unchanged and a nil slice.

func Scan

func Scan(text string) []Finding

Scan returns the distinct secrets found in text (deduplicated by match, sorted by type then match for deterministic output).

Jump to

Keyboard shortcuts

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