Expand description
Canonical secret-token and path prefixes shared by redaction layers across crates.
zeph-core::redact and zeph-memory::store::compression_guidelines both scrub
secrets and filesystem paths before persisting or displaying untrusted text. Each
crate previously carried its own hand-rolled copy of these lists, and the copies had
already begun to drift from each other (see #5917). This module is the single source
of truth for the raw prefixes/patterns; consumers compile their own regex::Regex
instances from these constants — zeph-common does not depend on regex outside of
tests, matching the pattern established by crate::patterns.
Constants§
- AWS_
SECRET_ KEY_ PATTERN - Regex pattern matching a raw AWS secret access key or session token immediately preceded by a recognizable marker and its assignment separator (see #6592).
- BEARER_
TOKEN_ PATTERN - Regex pattern matching
Authorization: Bearer <token>headers. - JWT_
PATTERN - Regex pattern matching standalone JWTs (three Base64url-encoded segments separated by dots).
- PATH_
PREFIXES - Absolute filesystem path prefixes redacted before persisting or displaying untrusted text, to avoid leaking local usernames or directory layout.
- PEM_
BODY_ CAP - Cap, in characters, on the PEM/SSH2 body matched by
PEM_PRIVATE_KEY_PATTERNandPEM_PRIVATE_KEY_UNTERMINATED_PATTERN. Kept as a named constant so the value referenced in both patterns’ doc comments (and inzeph_subagent::forward’s streaming holdback cap, which must buffer at least this many bytes past an unclosed header before force-flushing) stays traceable to one definition, even though the patterns themselves are plain&strliterals (regex patterns can’t be built from aconst usizevia string formatting at const-eval time without an extra dependency, so the literal8192is duplicated in both pattern strings — keep it in sync with this constant if it ever changes). - PEM_
PRIVATE_ KEY_ PATTERN - Regex pattern matching a full, properly-closed PEM/SSH2 private-key block, from the
-----BEGIN ... PRIVATE KEY------style header through the matching footer, inclusive of the body between them (see #6592). - PEM_
PRIVATE_ KEY_ UNTERMINATED_ PATTERN - Fallback regex matching a PEM/SSH2 private-key header with no matching footer found within
PEM_BODY_CAPcharacters — a header that is truncated, adversarially left unterminated, or whose footer chunk was dropped by a bounded ingress channel (see #6592 follow-up). - SECRET_
PREFIXES - Prefixes of API keys, tokens, and other secret material recognized across Zeph.