Skip to content

fix(security): extend compression_failure_pairs redaction to JWT Bearer tokens#1860

Merged
bug-ops merged 3 commits intomainfrom
fix/1847-jwt-bearer-redaction
Mar 15, 2026
Merged

fix(security): extend compression_failure_pairs redaction to JWT Bearer tokens#1860
bug-ops merged 3 commits intomainfrom
fix/1847-jwt-bearer-redaction

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 15, 2026

Summary

  • Add BEARER_RE static (case-insensitive) to redact_sensitive() — matches Authorization: Bearer <token> headers, replaces token value with [REDACTED], preserves header name via capture group
  • Add JWT_RE static — matches standalone Base64url JWTs (eyJ...) including alg=none tokens with empty signatures, replaces with [REDACTED_JWT]
  • 7 new unit tests covering: Bearer redaction, case-insensitive match, standalone JWT, alg=none empty-signature JWT, mixed content (all 4 patterns), partial JWT not matched, Cow::Borrowed fast-path for partial-JWT input

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy -p zeph-memory --all-targets -- -D warnings — zero warnings in changed file
  • cargo nextest run --workspace --features full --lib --bins — 5841 passed

Closes #1847

…er tokens

Add BEARER_RE and JWT_RE patterns to redact_sensitive() in
compression_guidelines.rs. BEARER_RE (case-insensitive) matches
Authorization: Bearer headers and replaces the token value with [REDACTED]
while preserving the header name. JWT_RE matches standalone Base64url JWTs
including alg=none tokens with empty signatures.

Closes #1847
@github-actions github-actions bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 15, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 18:00
@bug-ops bug-ops merged commit 3154f03 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the fix/1847-jwt-bearer-redaction branch March 15, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(security): extend compression_failure_pairs redaction to cover JWT Bearer tokens

1 participant