Require explicit consent for analyze-time semantic embeddings - #147
Require explicit consent for analyze-time semantic embeddings#147tachyon-beep wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR hardens loomweave analyze against unintended outbound embedding requests by requiring explicit operator opt-in before constructing an embedding provider and populating semantic embeddings, reducing the risk of project-configured exfiltration via semantic-search endpoints.
Changes:
- Added
--populate-semantic-embeddingsflag to theanalyzeCLI command and propagated it intoAnalyzeOptions. - Gated embedding-provider construction and
populate_semantic_embeddingsexecution behind the new opt-in flag. - Updated the
analyzeintegration test to assert that a normal analysis run does not create an embeddings sidecar.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/loomweave-cli/src/cli.rs | Introduces the new --populate-semantic-embeddings opt-in flag on the analyze command. |
| crates/loomweave-cli/src/main.rs | Wires the new CLI flag through to AnalyzeOptions. |
| crates/loomweave-cli/src/analyze.rs | Enforces the opt-in gate before building an embedding provider / populating embeddings. |
| crates/loomweave-cli/tests/analyze.rs | Adjusts integration test to ensure embeddings are not populated automatically. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| loomweave_bin() | ||
| .args(["analyze", "--config"]) | ||
| .arg(&config_path) | ||
| .arg(project_dir.path()) | ||
| .env("PATH", &plugin_path) | ||
| .assert() | ||
| .success(); |
| Err(e) => tracing::warn!( | ||
| run_id = %run_id, | ||
| error = %e, | ||
| "semantic embedding population skipped (run already committed successfully)" | ||
| ), |
|
Closing without merge — the concern is real, the fix is the wrong shape.
Tracked as Filigree |
Motivation
semantic_searchconfig could makeloomweave analyzeconstruct a live embedding provider and send source-derived text plus a config-selected environment variable to an attacker-controlled endpoint, creating an exfiltration path.Description
--populate-semantic-embeddingsto theanalyzecommand incrates/loomweave-cli/src/cli.rs.mainintoAnalyzeOptions(crates/loomweave-cli/src/main.rsandcrates/loomweave-cli/src/analyze.rs).populate_semantic_embeddingsincrates/loomweave-cli/src/analyze.rsso embedding population only runs when the operator supplies the new flag.crates/loomweave-cli/tests/analyze.rsto assert that a normalloomweave analyzedoes not create an embeddings sidecar and that embedding population remains possible when the operator opts in; adjust related test timing and reset steps to make the test deterministic.Testing
cargo test -p loomweave-cli analyze_persists_plugin_tags_without_automatic_embeddings -- --nocaptureand the targeted integration test passed.cargo fmt --all -- --checkwhich succeeded.git diff --checkandgit status --short --branchto validate tidy diffs and a clean working tree after the change.Codex Task