Skip to content

fix(mcp): add bounds validation for ema_floor config field in EmbeddingGuardConfig #2322

@bug-ops

Description

@bug-ops

Problem

EmbeddingGuardConfig::ema_floor (crates/zeph-config/src/sanitizer.rs) accepts any f32 from TOML without bounds checking:

  • 0.0 — freezes the centroid in steady state (no adaptation)
  • 1.0 — reverts to the original vulnerable running-mean behavior
  • Negative values — centroid diverges

Every other security-sensitive config field in this codebase uses a custom deserializer (e.g., validate_decay_lambda, validate_similarity_threshold in memory.rs).

Fix

Add a custom deserializer rejecting values outside (0.0, 1.0]. Follow the validate_decay_lambda pattern in crates/zeph-config/src/memory.rs.

Priority

P3 — admin-only config error, not exploitable remotely.

Related: PR fixing #2311

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexityenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions