Mongo tools silently accept a wrong database name and misreport `{collection, find}` commands as "undefined" or as permission denials
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- mongodb, sql, typescript
- 領域
- databases
調査の方向性
Start with normalizeMqlCommand in packages/drivers/src/mongodb.ts (around lines 79-102), which only rewrites string-valued native keys, and the resolveDb lookup near lines 241 and 413. Then read MONGO_READ_COMMANDS and the write fallback in packages/opencode/src/altimate/tools/sql-classify.ts, plus the error path in sql-materialize.ts around lines 180-185. Done when the acceptance checks in the issue pass: the collection/find shape matches the canonical form, a wrong database name lists valid databases, and listCollections is classified as a read.
索引モデルが issue の本文から書いたものです。
説明
Problem
- A command containing the wrong
databasename silently targets an empty database and returns "0 rows and no column information", which looks like a legitimate empty result. - The natural shape
{"collection": "articles", "find": {...}}(or"aggregate": [...]) is not normalised.sql_materializesaysMongoDB command "undefined" is not allowed;sql_executetreats it as a write and returns "The user has specified a rule which prevents you from using this specific tool call". listCollectionsis classified as a write; SQL text sent to a Mongo warehouse is denied as a permission problem instead of "this is MongoDB, use a JSON command".
Mechanism
normalizeMqlCommandonly rewrites native keys whose value is a string (packages/drivers/src/mongodb.ts:79-102), socommandstays undefined whenfindis an object.resolveDb(parsed.database)accepts any name (mongodb.ts:241-243,:413); no existence check.sql_materializeerror:sql-materialize.ts:180-185.sql_executepath:MONGO_READ_COMMANDSlackslistCollectionsandestimatedDocumentCount(packages/opencode/src/altimate/tools/sql-classify.ts:197), and an unparseable shape falls into the write path (:216-220).
Evidence
Recorded analyst sessions against a 127k-document collection:
- 7 silent empty reads (5 used the warehouse name as the database; 2 a nonexistent collection).
- 31
sql_materializecalls reported command "undefined" in one set of sessions (16 in another, 4 in a third) and 9sql_executecalls returned the permission text; it was the first Mongo call in all 10 sessions of one batch. - 9 SQL-on-Mongo permission denials.
Most sessions recovered after one turn; the silent empty read can silently corrupt an answer.
Impact
Correctness-risk (silent empty result) plus about one wasted turn per occurrence.
Proposed fix
- Accept
{collection, find: <filter>}and{collection, aggregate: <pipeline>}. - Validate
databaseand collection once per connection (listCollections/listDatabases) and return the available names on mismatch. - Add
listCollectionsandestimatedDocumentCountto the read commands. - Return a shape error, never a permission error, for unparseable Mongo input or SQL sent to Mongo.
Acceptance check
{"collection":"c","find":{"a":1}}runs identically to{"command":"find","collection":"c","filter":{"a":1}}in both tools.- A wrong database name returns an error listing valid databases, not an empty result.
listCollectionsis classified as a read.
- 主要言語
- TypeScript
- スター
- 810
- フォーク
- 121
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 89
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AltimateAI/altimate-code のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AltimateAI/altimate-code#1454 ·
メンテナーはふだん 1 日以内に返信
-
test: MCP tests fail when the developer's ~/.claude.json has MCP servers (HOME is not sandboxed)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AltimateAI/altimate-code#1386 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
AltimateAI/altimate-code#1384 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
AltimateAI/altimate-code#1323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
AltimateAI/altimate-code#1288 ·
メンテナーはふだん 1 日以内に返信
AltimateAI/altimate-code の issue をすべて見る
似ている issue
-
backend priority:P3 privacy-fix
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug desktop v3 windows
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
esengine/DeepSeek-Reasonix#13697 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:security documentation effort:S priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
app:web meta:ops
難易度 2/5 半日 初心者へのやさしさ 78/100
osu-tournament-rating/otr#1113 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100