Documentation
¶
Overview ¶
Package leakcheck is the one AD-3 leak checker of the test suites: it looks for more of a generated key than its redacted form in a captured output, raw and in its JSON-escaped, URL-encoded and base64-encoded views, and reports each hit by format, file, byte offset, encoding and finding id, never by the matched text.
Index ¶
Constants ¶
const ( EncodingRaw = "raw" EncodingJSON = "json" EncodingURL = "url" EncodingBase64 = "base64" )
Encodings a hit can be found in.
const UnknownID = "unknown"
UnknownID is the finding id of a key that matches no finding of the Report.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hit ¶
Hit is one place where an output holds more of a key than its redacted form. It never holds key material: its String and Error name the place, not the text.
func Check ¶
Check returns every hit of keys in data: a run of Window(len(key))+1 contiguous key characters found raw, after JSON-string unescaping, after URL percent-decoding or inside a decoded base64 run (standard or URL alphabet, padded or not, nested up to three times). Offsets are byte offsets into data; for a decoded view, the start of the escape region or of the base64 run. For a key shorter than its window plus one the run is the whole key: such a key is a hit only when it appears in full.
func CheckOutput ¶
CheckOutput is Check of data plus, when data is a PNG, of every chunk payload as file "<file> chunk <n>".
type Key ¶
Key is one generated key and the id of the finding it belongs to.
func IDsFromReport ¶
IDsFromReport resolves the finding id of each key by matching its redacted form (prefix, suffix and length) against the findings and credential parts of a JSON Report. A key that matches no finding gets UnknownID; one whose redacted form several findings share gets their ids joined by "|".