The eval viewer's safeJoin allows a sibling directory sharing the runs prefix
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, nodejs
研究方向
錯誤位於 packages/hdx-eval/scripts/viewer/server.js 中的 safeJoin(約第 39 行),它對解析後的根路徑只做了簡單的 startsWith 檢查。重現方法:建立同級目錄 runs-other,然後在第 176 行附近的 run 路由上請求 /api/batches/..%2Fruns-other/runs/a/b/c/1。完成標準是:檢查時以路徑分隔符為邊界與根目錄比較(或使用 path.relative),並且對同級目錄的請求回傳錯誤,而不是回傳檔案。
由索引模型根據 Issue 內容生成。
描述
The eval viewer's safeJoin allows a sibling directory sharing the runs prefix
Summary
The eval viewer's safeJoin checks only startsWith(path.resolve(root)). A sibling directory whose name begins with the runs root name passes the check. A crafted request can therefore read a JSON run artifact from outside the configured runs directory.
Location
- Repository:
hyperdxio/hyperdx - File:
packages/hdx-eval/scripts/viewer/server.js - Line: 39 (
safeJoin; the run route is at 176) - Revision:
1773c11942a7
Affected code
function safeJoin(root, ...parts) {
const p = path.resolve(root, ...parts);
if (!p.startsWith(path.resolve(root))) throw new Error('path escapes root');
return p;
}
The prefix check has no path-separator boundary.
Expected behavior
A request may only read files under the configured runs directory. A path resolving to a sibling such as runs-other/... must be rejected.
Actual behavior
Create a sibling runs-other/a/b/c/1.json next to runs, then run the viewer and request:
/api/batches/..%2Fruns-other/runs/a/b/c/1
The server returns the sibling file:
200 {"trajectory":{"secret":"outside"},"grade":null}
The file is outside packages/hdx-eval/runs.
Root cause
path.resolve(root, '../runs-other/...') produces a path that still starts with the root string (.../runs-other starts with .../runs). startsWith therefore accepts it.
Suggested fix
Append a path separator to the root before comparing, or use path.relative and reject results starting with .. or absolute paths:
const base = path.resolve(root);
const p = path.resolve(base, ...parts);
const rel = path.relative(base, p);
if (rel.startsWith('..') || path.isAbsolute(rel)) throw new Error('path escapes root');
return p;
- 主要語言
- TypeScript
- 星號
- 10.1k
- 分支
- 527
- 平均合併
- 1 天 20 小時
- 30 天內合併 PR
- 186
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ClickHouse/ClickStack 的其他 Issue
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several arguments可能已有人在做 @CG-5228 於 26 天前認領。 未關閉external
難度 2/5 1-3 小時 新手友好度 76/100
ClickHouse/ClickStack#3477 · 1 則留言 ·
維護者通常 1 天內回覆
-
Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limit可能已有人在做 @Tyagiquamar 於 27 天前認領。 未關閉alerting bug external
難度 2/5 1-3 小時 新手友好度 76/100
ClickHouse/ClickStack#3452 ·
維護者通常 1 天內回覆
-
check-alerts worker: 13 error spans (mongodb.create, NamespaceExists) every minute because mongoose autoCreate is still on可能重新可做 關聯的 PR 已關閉且未合併。 未關閉bug external Needs Feedback
難度 2/5 1-3 小時 新手友好度 72/100
ClickHouse/ClickStack#3308 · 1 則留言 ·
維護者通常 1 天內回覆
-
count_distinct aggFn on metric tiles ignores valueExpression, always counts distinct metric Values可能已有人在做 @Harshul1484 於 54 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
ClickHouse/ClickStack#2311 ·
維護者通常 1 天內回覆
-
enhancement Needs Feedback
難度 5/5 一週以上 新手友好度 25/100
ClickHouse/ClickStack#3687 ·
維護者通常 1 天內回覆
查看 ClickHouse/ClickStack 的全部 Issue
相似的 Issue
-
Add: GTrekker未關閉check:passed streams:add
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
area: ui Bug Payload OSS
難度 1/5 1 小時以內 新手友好度 88/100
payloadcms/payload#19839 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
fix(auth): add the email OTP verification step to Pollar login可能已有人在做 @akansnoro 今天認領。 未關閉Stellar Wave
難度 2/5 1-3 小時 新手友好度 74/100
safetrustcr/dApp-SafeTrust#584 · 10 則留言 ·
維護者通常 1 天內回覆
-
The manager preset saves launch definitions without the required file and digest pair可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 80/100
維護者通常 1 天內回覆