localcreds

package
v0.15.21 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 7 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 localcreds finds the credentials configured on this machine, so a report can say that a leaked token is not just out there but still in use right here.

Each provider says where its tools keep tokens: environment variables holding a token or naming a file, files under the config and home directories, commands that print one. The working directory's .env files are checked for every provider. The environment variables are searched together, as the lines of one document, so a credential that is only complete with a companion from another variable (a storage key and its account name, an AWS key id and its secret) is found the way it would be in an .env file. Only fingerprints leave this package; token values are hashed as soon as they are read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(creds []Credential) map[string][]string

Match indexes credentials by fingerprint: the sources each token is configured in.

Types

type Credential

type Credential struct {
	Fingerprint string
	// Source says where it was found: a file path, an environment variable
	// or a command.
	Source string
}

Credential is one token configured locally, identified by fingerprint.

func Find

func Find(ctx context.Context, registry *detect.Registry) []Credential

Find returns every credential configured on this machine that the registry's providers know where to look for. Missing files and failing commands are simply not credentials; Find never returns an error.

Jump to

Keyboard shortcuts

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