Reminisce.SecretGuard (reminisce v0.6.0)

Copy Markdown View Source

The built-in secret guard: refuses a secret at the door.

Every text the library is about to store goes through scan/1 first — content, facets, sources, reasons, subjects and keys. A hit refuses the whole write as {:error, {:secret, rule_id}}, writes nothing, and emits [:reminisce, :guard, :refused] telemetry carrying the rule id and no text.

The rules follow the shapes of gitleaks' default rule families: private-key headers, cloud keys (AWS, GCP, Azure), forge and chat tokens (GitHub, GitLab, Slack), payment keys (Stripe, Square), JWTs, package-registry tokens, AI provider keys, and generic password= / token= assignments carrying a high-entropy value. Most rules are derived from gitleaks 8.28.0 (MIT); NOTICE names them and the licence.

What it cannot do: a scanner finds shapes, not intent. A secret in a shape it does not know gets through. The host's Reminisce.Policy is the second line.

Summary

Functions

The rule ids, for documentation and tests.

Scans one text. :ok, or {:secret, rule_id} for the first rule that hits.

Scans every string inside a term (maps, lists, tuples).

Functions

rule_ids()

The rule ids, for documentation and tests.

scan(text)

@spec scan(String.t()) :: :ok | {:secret, atom()}

Scans one text. :ok, or {:secret, rule_id} for the first rule that hits.

scan_all(term)

@spec scan_all(term()) :: :ok | {:secret, atom()}

Scans every string inside a term (maps, lists, tuples).