secrets

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package secrets is the one credential-shaped-string rule set, shared by the two places that look: the hub's share gate (internal/webapp/shares.go, which refuses to mint) and the sync scan (internal/syncer, which only warns). It imports the standard library and nothing else, so the syncer can use it without depending on the server.

Both callers say the same thing about time: the check ran when the bytes were read — at the moment you shared it, or the moment the file last changed. Neither one ever claims a file is clean.

The matched text never leaves this package. Rule ids and line numbers only, in a 409 body, in `bdrive status`, in an agent's context, in a log line.

Index

Constants

View Source
const ScanLimit = 1 << 20

ScanLimit is how much of a file the share gate reads. The boundary is a decision, not an accident: a key past the first MiB mints silently, which is asserted in shares_test.go so nobody "fixes" it by accident.

Variables

This section is empty.

Functions

func Label

func Label(rule string) string

Label renders a rule id for a human. An id with no label renders as itself — a bare id is ugly, but a rule that reports nothing is worse.

Types

type Finding

type Finding struct {
	Rule string `json:"rule"`
	Line int    `json:"line"`
}

Finding is one credential-shaped string: which rule fired, and where. Never the matched text — see Scan.

func Scan

func Scan(buf []byte) []Finding

Scan reports credential-shaped strings in buf, as rule ids and line numbers ONLY. The matched text must never reach a response body, a log line, or a metric label — the same argument reads.go:28-40 makes for actor identity, and a 409 body is the easiest place in the codebase to leak it.

Byte-oriented on purpose: a bufio.Scanner over a 1 MiB minified file with no newline blows its 64 KiB token limit and returns nothing at all, which is a check that silently passes everything.

Jump to

Keyboard shortcuts

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