Documentation
¶
Overview ¶
Package capturedisclosure is the single disclosure owner for both HTTP capture directions: pure functions from raw captured facts to stored values, with no I/O. Input it cannot represent safely is omitted with a reason, never stored raw.
Index ¶
- Constants
- func Bytes(data []byte) []byte
- func CredentialName(name string, extra Names) bool
- func CredentialQueryName(name string, extra Names) bool
- func Fields(raw string, truncated bool, p Policy, mask func(string) bool) (fields []httpcapture.Field, cut bool, valid bool)
- func Headers(fields []httpcapture.Field, mask, query func(string) bool) []httpcapture.Field
- func Inspectable(contentType, contentEncoding string) (Media, Reason)
- func NonNil[T any](items []T) []T
- func Omitted(size int) string
- func Text(text string) string
- func TextLimit(text string, limit int) string
- type Format
- type Media
- type Names
- type Policy
- type Reason
Constants ¶
const Masked = "[masked]"
Masked replaces a credential value in every mode.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes keeps an absent body as zero bytes: body columns are NOT NULL and the byte codec rejects a nil slice.
func CredentialName ¶
CredentialName decides header and body field names in both capture directions. It errs toward masking: a false positive hides one value, a false negative stores a vendor key for every developer to read.
Authorization, Set-Cookie, X-Api-Key, client_secret -> record.SensitiveName auth, X-Auth-Token, x_auth, authToken -> the word auth key, X-RapidAPI-Key, Ocp-Apim-Subscription-Key -> a separated final word key subscriptionKey, accesskey -> a listed key compound Idempotency-Key, monkey, author, oauth_state -> visible
func CredentialQueryName ¶
CredentialQueryName adds the framework's own bearer parameters (a ticket or a signed-URL signature) and the words sig and signature, so presigned URLs such as X-Amz-Signature cannot be replayed from a viewer. Signature headers stay visible: an HMAC over one body grants nothing.
func Fields ¶
func Fields(raw string, truncated bool, p Policy, mask func(string) bool) (fields []httpcapture.Field, cut bool, valid bool)
Fields parses URL-encoded pairs in first-appearance order, grouping repeated names and masking values whose names mask matches. A truncated input drops its possibly partial last pair. It reports false for any malformed escape instead of keeping raw text, and cut when the field bound stopped it.
func Headers ¶
func Headers(fields []httpcapture.Field, mask, query func(string) bool) []httpcapture.Field
Headers masks the values of names mask matches, masks the query and fragment values of URL-valued headers whose names query matches, and makes text storable. Webhook response headers pass rules that match nothing: they are what the application sent, kept whole for debugging.
func Inspectable ¶
Inspectable decides, from Content-Type and Content-Encoding alone, whether redacted mode can store a body. Outbound capture calls it before buffering and redaction calls it again, so the two never disagree.
func NonNil ¶
func NonNil[T any](items []T) []T
NonNil stores an absent list as an empty JSON array.
Types ¶
type Media ¶
type Media struct {
Format Format
// contains filtered or unexported fields
}
Media is a body's parsed redaction format.
type Names ¶
type Names map[string]struct{}
Names are extra credential names from deployment settings, matched exactly and case-insensitively.
type Policy ¶
Policy is the immutable redaction input: value and output bounds and the extra credential names deployment settings add.