redact

package
v0.0.0-...-53bd38a Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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 provides best-effort stripping of sensitive values from JSON config payloads served by unauthenticated diagnostic endpoints. The canonical defense is to keep inline secrets out of config entirely (use *_file paths instead); this layer is defense-in-depth.

Index

Constants

This section is empty.

Variables

View Source
var SecretHeaders = map[string]bool{
	"authorization":       true,
	"proxy-authorization": true,
	"cookie":              true,
	"set-cookie":          true,
	"x-api-key":           true,
	"api-key":             true,
	"x-goog-api-key":      true,
}

SecretHeaders are the request and response headers that carry credentials. They never reach a script, and they are removed from a request before the session archive captures it: a credential has no business in a log, on the timeline or on disk. Keys are lower-case.

Functions

func CredentialName

func CredentialName(name string) bool

CredentialName reports whether name, split at "-" and "_" with case ignored, has one of credentialWords. It covers every name in SecretHeaders.

func Headers

func Headers(h http.Header) http.Header

Headers is a copy of h without credential headers, for storing.

func JSON

func JSON(raw json.RawMessage) json.RawMessage

JSON redacts values whose keys match sensitive patterns in a json.RawMessage. Non-object inputs are returned unchanged.

func Query

func Query(raw string) string

Query is raw without credential parameters, for storing. The rest is kept as it was, in its order and escaping, since a replay must send the same bytes. A query that does not parse is dropped whole: what it holds cannot be told apart.

Types

This section is empty.

Directories

Path Synopsis
Package content finds secrets in content: the text of request and response bodies, SSE streams, and the text fields of session events (#1921).
Package content finds secrets in content: the text of request and response bodies, SSE streams, and the text fields of session events (#1921).

Jump to

Keyboard shortcuts

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