redact

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 3 Imported by: ? 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 redact masks secrets before they reach a terminal, a log or a telemetry backend. allbctl output is routinely pasted into issues and shared screens, so anything credential-shaped is hidden by default.

Index

Constants

View Source
const Mask = "********"

Mask is what a hidden value is replaced with.

Variables

This section is empty.

Functions

func AWSAccountIDs added in v0.1.0

func AWSAccountIDs(value string) string

AWSAccountIDs masks every AWS account ID (a run of exactly twelve digits) in value. Profile names generated by AWS SSO embed the account ID, as do ARNs and many SDK error messages.

func ClusterName added in v0.2.0

func ClusterName(value string) string

ClusterName masks the account a generated Kubernetes context or cluster name gives away: the AWS account ID in an EKS ARN and the project ID in a GKE name ("gke_<project>_<location>_<cluster>"). Names people chose themselves are returned unchanged.

func EmailAddress added in v0.2.0

func EmailAddress(value string) string

EmailAddress masks who an e-mail address belongs to and keeps its domain: "dev.person@example.test" becomes "d********@example.test". The domain of a Google Cloud service account names its project, which is masked too. A value that is not an address is treated as an Identifier.

func EnvValue

func EnvValue(key, value string) string

EnvValue returns value in a form safe to display for the given key: fully masked for secret-looking keys, and with any embedded URL password masked otherwise (e.g. DATABASE_URL=postgres://user:pass@host/db).

func Identifier added in v0.2.0

func Identifier(value string) string

Identifier masks the middle of an identifier such as a project ID or a subscription GUID: "example-project-123456" becomes "ex********56". An identifier too short for that is masked entirely.

func IsSecretKey

func IsSecretKey(key string) bool

IsSecretKey reports whether a key name looks like it holds a credential.

func URLPassword

func URLPassword(value string) string

URLPassword masks the password of a URL that embeds credentials. Values that are not URLs, or carry no password, are returned unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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