BeamAgent.SensitiveKeys (beam_agent_ex v0.1.0)

Copy Markdown View Source

Single source of truth for sensitive key definitions.

Every key that must be encrypted in credential storage, redacted from logs, or both is defined as a triple in the canonical registry. The credential and redaction modules derive their match lists from this module rather than maintaining separate, driftable lists.

Triple Fields

Each entry is {canonical_name, category, handling}:

  • canonical_name -- Erlang atom in snake_case (e.g., :api_key).
  • category -- Classification: :credential, :auth, :session, or :oauth.
  • handling -- Protection level:
    • :encrypt_and_redact -- Encrypted at rest AND redacted from logs.
    • :redact_only -- Redacted from logs only (not stored in credentials).

Examples

# Get all 18 sensitive key definitions
BeamAgent.SensitiveKeys.all()

# Check if a key is sensitive (any format)
BeamAgent.SensitiveKeys.is_sensitive(:api_key)       # true
BeamAgent.SensitiveKeys.is_sensitive("apiKey")        # true
BeamAgent.SensitiveKeys.is_sensitive("username")      # false

Delegates to :beam_agent_redaction (Erlang).

Summary

Types

A sensitive key triple as defined in :beam_agent_redaction: {name, category, handling}.

Functions

Return the canonical list of sensitive key triples.

Flat list of all format variants for keys that require encryption.

Check whether a key (atom or binary, any format) is sensitive.

Canonical lowercase binary keys (no separators) for all sensitive keys.

Types

key_entry()

@type key_entry() :: :beam_agent_redaction.key_entry()

A sensitive key triple as defined in :beam_agent_redaction: {name, category, handling}.

Functions

all()

@spec all() :: [key_entry(), ...]

Return the canonical list of sensitive key triples.

credential_match_keys()

@spec credential_match_keys() :: [atom() | binary()]

Flat list of all format variants for keys that require encryption.

Each multi-word key produces three variants: the atom, a camelCase binary, and a snake_case binary. Single-word keys produce two.

is_sensitive(key)

@spec is_sensitive(atom() | binary()) :: boolean()

Check whether a key (atom or binary, any format) is sensitive.

redaction_match_keys()

@spec redaction_match_keys() :: [binary()]

Canonical lowercase binary keys (no separators) for all sensitive keys.