printcheck

package
v1.0.0-dev.14 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package printcheck finds a secret a printer could show. Unmasked checks types: it reports every field of a type graph that can carry text and is neither a masked type nor a reviewed non-secret field. Leak checks a printer's output for a secret's text, its HMAC pad forms, and their hex or base64. Import it only from access's _test.go files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyForms

func KeyForms(key string) []string

KeyForms returns the forms of key a printer can show: key itself, and key XOR 0x36 and XOR 0x5c, the inner and outer pads a crypto/hmac value caches (RFC 2104 §2), each in clear, hex and base64.

func Leak

func Leak(got, text string) bool

Leak reports whether got contains text in any form KeyForms returns. text must not be empty (every string contains it), and a text of a few bytes has base64 runs short enough to match by chance.

func Unmasked

func Unmasked(a Allow, roots ...reflect.Type) []string

Unmasked walks each root's type graph through struct fields (unexported included), pointers, slices, arrays and maps, and returns, sorted, one line per field that can carry text: a string, an integer slice or array (a []byte, an expanded key schedule), or an interface, whose dynamic value the type does not fix. Masked types, allowed types and allowed fields are not entered; an allow entry no root reached is reported, so none goes stale. Funcs, chans and unsafe pointers pass: every printer shows an address.

Types

type Allow

type Allow struct {
	// Masked are the types whose own tests pin that they hold no text in
	// clear (access.Secret, access.Hash and their shared masked value).
	Masked []reflect.Type
	// Fields are reviewed non-secret fields, each written as its declaring
	// type's reflect.Type.String, a dot and the field name: "access.User.Email".
	Fields []string
	// Types are reviewed non-secret types, by reflect.Type.String: "time.Time".
	Types []string
}

Allow is what Unmasked accepts without looking inside it.

Jump to

Keyboard shortcuts

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