Documentation
¶
Overview ¶
Package repocheck holds the repository-wide consistency tests (formats page, stability table, package catalogs and names, documentation Go samples, agent skill, format conformance coverage, example platform targets); it has no API.
Privacy rules shared by the repository scan (TestNoPrivateFindings) and the release package scan (internal/pkgscan): the file names, personal paths and credential shapes the repository refuses to carry.
Index ¶
- Constants
- func ApplyPrivacyExemptions(findings []Finding, x Exemptions) (kept []Finding, unused []Exemption)
- func EncodePrivacyExemptions(x Exemptions) ([]byte, error)
- func ScanShippedFiles(fsys fs.FS, names []string) ([]Finding, Coverage, error)
- type Coverage
- type Exemption
- type Exemptions
- type Finding
Constants ¶
const PrivacyExemptionsPath = "internal/repocheck/testdata/privacy-exemptions.yaml"
PrivacyExemptionsPath is the versioned list of reviewed privacy findings that are safe to keep, relative to the repository root.
Variables ¶
This section is empty.
Functions ¶
func ApplyPrivacyExemptions ¶
func ApplyPrivacyExemptions(findings []Finding, x Exemptions) (kept []Finding, unused []Exemption)
ApplyPrivacyExemptions drops the exempted findings and returns the rest, with the entries that exempted nothing.
func EncodePrivacyExemptions ¶
func EncodePrivacyExemptions(x Exemptions) ([]byte, error)
EncodePrivacyExemptions writes the document in the committed layout, so a parse and encode round trip reproduces the file.
func ScanShippedFiles ¶
ScanShippedFiles applies the rules to the named files of a package's contents, which, unlike the repository, are mostly binary. It does what ScanPrivacy does and also runs the secret rules over the printable bytes of binary files (ScanBinary) and the personal path rule over the targets of symbolic links (ScanLinkTarget), and it counts how each file was scanned.
Types ¶
type Coverage ¶
type Coverage struct {
Text, Binary, Links int
}
Coverage counts how ScanShippedFiles scanned a package's files, so its caller can say what each rule saw: Text files got every rule, Binary files only the secret rules (ScanBinary), and Links only the personal path rule over their targets (ScanLinkTarget).
type Exemption ¶
type Exemption struct {
Path string `yaml:"path"`
Pattern string `yaml:"pattern,omitempty"`
Reason string `yaml:"reason"`
}
Exemption allows the findings in one tracked file: only those whose matched text contains Pattern, or every finding in the file when Pattern is empty.
type Exemptions ¶
Exemptions is the document stored at privacyExemptionsPath.
func ParsePrivacyExemptions ¶
func ParsePrivacyExemptions(data []byte) (Exemptions, error)
ParsePrivacyExemptions decodes and validates an exemptions document: version 1, unknown fields refused, every entry with a clean relative path and a reason, sorted by path and pattern without duplicates.
type Finding ¶
Finding is one rule hit in one tracked file. A hit in a binary file has no line: Binary is set and Offset is the byte offset of the match.
func ScanBinary ¶
ScanBinary applies the secret rules to the printable runs of a binary file, as strings(1) would list them: every byte outside printable ASCII, tab, line feed and carriage return separates runs. The personal path rule is not applied, because a compiled binary can carry build paths that are not private data, and the release builds use -trimpath so their own paths do not appear.
func ScanLinkTarget ¶
ScanLinkTarget applies the personal path rule to the target of the symbolic or hard link name, so a link into a build machine's home directory is reported even though the link itself is never followed.
func ScanPrivacy ¶
ScanPrivacy applies the file name, personal path and secret rules to the named files of fsys, as the repository scan does. Symbolic links, directories (such as submodules), missing files and binary files (any NUL byte) are skipped.