Skip to content

Require explicit consent for analyze-time semantic embeddings - #147

Closed
tachyon-beep wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-analyze-embedding-process
Closed

Require explicit consent for analyze-time semantic embeddings#147
tachyon-beep wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-analyze-embedding-process

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

Motivation

  • A repository-controlled semantic_search config could make loomweave analyze construct a live embedding provider and send source-derived text plus a config-selected environment variable to an attacker-controlled endpoint, creating an exfiltration path.
  • The change aims to prevent outbound embedding requests during a normal analysis run unless the operator explicitly opts in.

Description

  • Add an explicit opt-in CLI flag --populate-semantic-embeddings to the analyze command in crates/loomweave-cli/src/cli.rs.
  • Propagate the new flag through main into AnalyzeOptions (crates/loomweave-cli/src/main.rs and crates/loomweave-cli/src/analyze.rs).
  • Gate provider construction and the call to populate_semantic_embeddings in crates/loomweave-cli/src/analyze.rs so embedding population only runs when the operator supplies the new flag.
  • Update integration test coverage in crates/loomweave-cli/tests/analyze.rs to assert that a normal loomweave analyze does 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

  • Ran cargo test -p loomweave-cli analyze_persists_plugin_tags_without_automatic_embeddings -- --nocapture and the targeted integration test passed.
  • Ran formatting checks with cargo fmt --all -- --check which succeeded.
  • Ran repository checks git diff --check and git status --short --branch to validate tidy diffs and a clean working tree after the change.

Codex Task

Copilot AI lite review requested due to automatic review settings September 1, 2026 18:49
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-embeddings flag to the analyze CLI command and propagated it into AnalyzeOptions.
  • Gated embedding-provider construction and populate_semantic_embeddings execution behind the new opt-in flag.
  • Updated the analyze integration 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.

Comment on lines 1335 to 1341
loomweave_bin()
.args(["analyze", "--config"])
.arg(&config_path)
.arg(project_dir.path())
.env("PATH", &plugin_path)
.assert()
.success();
Comment on lines +1867 to +1871
Err(e) => tracing::warn!(
run_id = %run_id,
error = %e,
"semantic embedding population skipped (run already committed successfully)"
),
@tachyon-beep

Copy link
Copy Markdown
Collaborator Author

Closing without merge — the concern is real, the fix is the wrong shape.

  • Gating analyze-time embeddings behind a new CLI flag disables them on every real launch path (session hook, git-sync hooks, MCP analyze_start) even when the operator enabled semantic_search in their own config. semantic_search is already opt-in; the problem is not consent, it is that the consent lives in a file (loomweave.yaml) that may be repository-authored.
  • It covers only the analyze-time embedding path; the same hostile config can point llm_policy at an attacker endpoint for serve-time summaries, and can name which env var is sent as the credential. Both surfaces need one operator-trust gate.
  • The branch conflicts with the worktree-store refactor (store_paths.embeddings).

Tracked as Filigree clarion-dee44f1a66 (P1): distinguish operator-owned config from repo content (git-tracked check and/or an out-of-tree operator config), constrain the credential env-var name and endpoint host, with an ADR.

@tachyon-beep
tachyon-beep deleted the codex/fix-vulnerability-in-analyze-embedding-process branch September 1, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants