[bug](http) MetaInfoAction.getAllDatabases() leaks unfiltered db list, bypassing SHOW privilege
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java の getAllDatabases() から始め、続いて fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java のフィルタリングとページネーションのフローを比較します。v1 エンドポイントがデータベース名をソートし、SHOW で許可されたデータベース名だけを返し、レスポンスでフィルタリング前のリストを使用しない状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
MetaInfoAction.getAllDatabases() (the v1 HTTP metadata interface) returns the full list of database names regardless of the caller's SHOW privilege. The privilege-filtered result (dbNameSet) is computed but never used; the method sorts and returns the unfiltered dbNames.
This is distinct from PR #65126 — it is a pre-existing master bug, not introduced by that PR. The only change PR #65126 made to this method was the line:
- List<String> dbNames = catalog.getDbNames();
+ List<String> dbNames = new ArrayList<>(catalog.getDbNames());
which was needed to fix an UnsupportedOperationException after getDbNames() started returning an immutable list. It is unrelated to the privilege-filtering bug.
Affected code
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java
List<String> dbNames = new ArrayList<>(catalog.getDbNames()); // L108 all db names
List<String> dbNameSet = Lists.newArrayList(); // L109
for (String db : dbNames) {
if (!Env.getCurrentEnv().getAccessManager()
.checkDbPriv(ConnectContext.get(), InternalCatalog.INTERNAL_CATALOG_NAME, db,
PrivPredicate.SHOW)) {
continue; // skip db without SHOW
}
dbNameSet.add(db); // L116 filtered result
}
Collections.sort(dbNames); // L119 sorts dbNames (unfiltered)
Pair<Integer, Integer> fromToIndex = getFromToIndex(request, dbNames.size());
return ResponseEntityBuilder.ok(dbNames.subList(...)); // L123 returns UNFILTERED dbNames
dbNameSet is dead code; the response returns the unfiltered, all-privilege dbNames.
Auth surface / impact
checkWithCookiealways requires a valid authenticated session (Authorization header or valid cookie), so this is not anonymous access.enable_all_http_authdefaults tofalsein most deployments. With the default, any authenticated non-admin user hitting/api/meta/{ns}/databasescan enumerate every database name in the catalog, bypassingSHOWprivilege.- When
enable_all_http_auth = true, only admin can reach the endpoint, so the leakage is limited to admins.
Impact: information disclosure / privilege bypass at the metadata-enumeration level (database names only; table/column data is gated by other checks).
Correct reference (v2)
MetaInfoActionV2.getAllDatabases() does this correctly — it accumulates into filteredDbNames, sorts it, and returns it:
fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java (lines ~130–145)
List<String> filteredDbNames = Lists.newArrayList();
// ... checkDbPriv(SHOW) -> filteredDbNames.add(db)
Collections.sort(filteredDbNames);
return ResponseEntityBuilder.ok(filteredDbNames.subList(...));
Suggested fix
Align v1 with v2: return the privilege-filtered (and sorted) dbNameSet / filteredDbNames instead of dbNames, and drop the dead code. This is outside the scope of PR #65126 (external metadata cache refactor) and is tracked separately here.
Related
- PR #65126 (
[refactor](meta cache) Refactor external metadata cache with MetaCacheEntry)
- 主要言語
- Java
- スター
- 16k
- フォーク
- 4k
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 674
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/doris のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
4.1.4.1 Release Noteオープンrelease notes
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[Bug] FE metric http_copy_into_query_err_total is registered under the upload error name対応中かも @manesioz が 20 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
apache/doris#68505 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
RRateLimiter acquire methods accept negative permits and raise available permits above the rate.オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
krahets/hello-algo#1993 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NationalSecurityAgency/ghidra#9884 ·
メンテナーはふだん 2 日以内に返信
-
Status: Pending Review Type: Feature Request
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
OpenRefine/OpenRefine#8019 ·
メンテナーはふだん 1 日以内に返信
-
[TEMP] pin maven version to 3.9.x対応中かも @petrenyi-mark が今日担当しました。 オープン
難易度 2/5 1時間未満 初心者へのやさしさ 62/100