Documentation
¶
Overview ¶
Package redacttest holds the credential-bearing inputs that every URL redaction helper must handle. The helpers in pkg/artifact and pkg/utils share one security property, so they share one table: a test feeds the same cases to each helper and asserts that no secret survives.
Index ¶
Constants ¶
const ( // User is a distinctive user name, so a test can tell it apart from any host or path. User = "usr7" // SecretA and SecretB are distinctive password fragments. SecretA = "S3cr3tA" // SecretB is the second password fragment, used when a delimiter splits a password in two. SecretB = "S3cr3tB" // SecretC is the third password fragment, used when two delimiters split a password in three. SecretC = "S3cr3tC" // Marker starts every secret the generated inputs carry, so a leak of any fragment of a secret, // however a delimiter cut it, is a leak of the marker. Marker = "S3cr3t" )
Variables ¶
This section is empty.
Functions ¶
func Leaks ¶
Leaks returns what survives in out of the user name and of the secret: every fragment of a secret starts with Marker, so a delimiter inside the secret cannot hide a leak.
func RequireNoLeak ¶
RequireNoLeak fails the test when out, the redacted output of the entry point named entry for in, still holds the user name or any fragment of the secret.
Types ¶
type Case ¶
type Case struct {
// Name describes the shape of the input.
Name string
// Raw is the URL, or URL-like address, that carries the credential.
Raw string
// Secrets are the strings that must never appear in the redacted form of Raw: the user, the
// password, and every fragment a delimiter inside the password could leave behind.
Secrets []string
// Quoted are the passwords an error may quote on their own, in any form a parser can decode.
Quoted []string
}
Case is one credential-bearing input.
type Input ¶
type Input struct {
// Name describes the template the address was built from.
Name string
// Raw is the address.
Raw string
// Password is the password as it was typed into Raw, or empty when Raw has none.
Password string
}
Input is one generated credential-bearing address and the ways an error may quote it.
func Generate ¶
Generate embeds secret as the password of many address templates: user information of every scheme, with the secret before and after other delimiters, in an escaped form, repeated in the query and the fragment, and with hosts named like digests. Each address ends its user information with an "@" of its own, so the secret is always a credential and never a host. The secret may hold any delimiter, so the same template covers a password that closes the authority early.