File Search worker finds no work when the database user has neither superuser nor BYPASSRLS

未关闭
#1,418 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
postgresql, typescript
领域
backend, database

调研方向

Start with FileSearchRepository.withTenant and the worker's cross-workspace queries: scheduler lease claim, extend and release, the share sweep, and closing interrupted runs (#1417), none of which set app.current_org. Check the existing org_isolation policies on the file_* tables, then add a migration with a maintenance switch such as app.files_maintenance. Done means the worker finds work and sweeps shares under a non-superuser role without BYPASSRLS, covered by an integration test modeled on the #1395 CREATEROLE check.

由索引模型根据 Issue 内容生成。

描述

Problem

The file_* tables use FORCE ROW LEVEL SECURITY; tenant queries go through FileSearchRepository.withTenant (app.current_org, optionally SET LOCAL ROLE amcp_files). The worker's cross-workspace maintenance queries do not set app.current_org:

  • scheduler lease claim, extend and release;
  • share sweep;
  • closing interrupted runs (#1417).

They rely on the application user bypassing RLS: superuser, which is the case on AnythingMCP Cloud and in the default Docker Compose setup.

On a self-hosted install whose application user is neither superuser nor BYPASSRLS (some managed PostgreSQL offerings), those queries see no rows. Syncs then never start, and expired share files are not swept. Nothing errors.

Proposal

  • A new migration extends the org_isolation policies with an explicit maintenance switch, for example OR current_setting('app.files_maintenance', true) = 'on'.
  • The worker's cross-workspace queries run inside a transaction with set_config('app.files_maintenance', 'on', true).
  • Add an integration test as a non-superuser role, like the one used for #1395's CREATEROLE check.

Found while hardening File Search on 2026-11-01. Relates to #1379, #1380, #1383.

主要语言
TypeScript
星标
856
派生
82
平均合并
6 小时 43 分钟
30 天内合并 PR
399

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

HelpCode-ai/anythingmcp 的其他 Issue

查看 HelpCode-ai/anythingmcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。