Skip to content

fix(reads): enforce workspace scope in session fallback and relationship census - #705

Merged
tteon merged 3 commits into
mainfrom
fix/enforce-workspace-filter-2632270074069326120
Oct 13, 2026
Merged

tteon merged 3 commits into
mainfrom
fix/enforce-workspace-filter-2632270074069326120

Conversation

@tteon

@tteon tteon commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Modified Files: src/seocho/session.py, src/seocho/local_engine.py, src/seocho/index/pipeline.py, tests/seocho/test_chunk_fallback.py, tests/seocho/test_ontology_context.py

Severity: High
Vulnerability: Several read queries in session.py, local_engine.py, and pipeline.py executing dynamic Cypher via graph_store.query() were missing explicit enforce_workspace_filter=True checks, and in one case missed the workspace_id Cypher parameter entirely. This allowed theoretical tenant-isolation bypasses where cross-tenant nodes could be queried.
Impact: An attacker interacting with a pipeline or session could potentially extract or count node statistics belonging to other tenants by forging or passing cross-tenant IDs.
Fix: Updated the graph_store.query() invocations to pass workspace_id=self.workspace_id and enforce_workspace_filter=True as kwargs, explicitly modifying the Cypher query in session.py to enforce n._workspace_id = $workspace_id. Also updated mock test stores in test_chunk_fallback.py and test_ontology_context.py to gracefully accept **kwargs so tests pass correctly.
Validation: Verified locally via pytest unit tests (tests/seocho/test_chunk_fallback.py and tests/seocho/test_ontology_context.py) and ran the full CI script bash scripts/ci/run_basic_ci.sh.
Risks: Minor risk of regressions if any backend implementations of GraphStore do not adhere to the base GraphStore contract (which does accept these kwargs). Test mocks have been updated to mitigate this.


PR created automatically by Jules for task 2632270074069326120 started by @tteon

Maintainer integration review (2026-10-13)

The domain relationship census scopes a, b and r to the workspace. Added session fallback and census regressions; chunk fallback tests assert the enforcement arguments. Targeted tests: 27 passed.

Validation of the exact combined changes on current main: bash scripts/ci/run_basic_ci.sh — 1,252 passed, 3 skipped; all remaining lint/type/import/root/env/identity gates passed. bash scripts/ci/check-doc-contracts.sh passed. Local tracking: seocho-xlo1. Source changes remain in their owning SDK modules; local agent state stays untracked.

Co-authored-by: tteon <52625664+tteon@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T13:13:38.931468Z 5f356c4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area-indexing Indexing, extraction, graph shaping, linking, or ingestion. area-sdk Public Python SDK, client facade, session API, or typed models. kind-bug A reproducible defect or regression. kind-test Test coverage, fixtures, or validation-only changes. status-needs-triage Needs maintainer triage before work starts or merges. labels Sep 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c6a179abd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/seocho/index/pipeline.py Outdated
@tteon tteon changed the title fix: enforce workspace filter in un-isolated graph queries fix(reads): enforce workspace scope in session fallback and relationship census Oct 13, 2026
@tteon
tteon merged commit f9e3738 into main Oct 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-indexing Indexing, extraction, graph shaping, linking, or ingestion. area-sdk Public Python SDK, client facade, session API, or typed models. kind-bug A reproducible defect or regression. kind-test Test coverage, fixtures, or validation-only changes. status-needs-triage Needs maintainer triage before work starts or merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant