Skip to content

fix(core): room consolidation applies the privacy filter before the embedder (#1464) - #1604

Merged
ajianaz merged 1 commit into
developfrom
fix/consolidation-filter-before-embed
Oct 30, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/consolidation-filter-before-embed

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

What

ConsolidationStore::embed_content runs the privacy filter before the embedder: the text is masked (or refused in strict mode) and the masked text is embedded, so the vector matches the stored text. The comment in insert_memory that claimed the earlier embedding was harmless is corrected. CHANGELOG entry under the 0.22.0 Security section.

Why

Found by the Cora review of the v0.22.0 release PR (#1603): consolidated text came from an LLM, was embedded first and masked only when stored. With an openai or ollama backend an unmasked secret in that text would reach the remote embedding provider. The sources were already masked when written, so the exposure needed the LLM to introduce a secret (or the filter to be off at write time), but the order was wrong and strict mode could not prevent it.

Testing

  • cargo fmt, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo test --workspace --locked.
  • New test consolidated_text_is_filtered_before_it_is_embedded: a recording embedder never sees the token in default mode, and in strict mode the text is refused and nothing is embedded. It fails with the old behaviour (checked by reverting the change).

…mbedder (#1464)

The consolidated text was embedded first and filtered on store, so a remote embedding backend could receive an unmasked secret. The text is now validated and masked before it is embedded; strict mode refuses it and nothing is embedded.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 92a1fb6 into develop Oct 30, 2026
14 checks passed
@ajianaz
ajianaz deleted the fix/consolidation-filter-before-embed branch October 30, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant