The eval viewer's safeJoin allows a sibling directory sharing the runs prefix
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, nodejs
Hướng nghiên cứu
Lỗi nằm trong safeJoin ở packages/hdx-eval/scripts/viewer/server.js (khoảng dòng 39), dùng kiểm tra startsWith đơn giản trên thư mục gốc đã được phân giải. Để tái hiện, hãy tạo thư mục anh em runs-other rồi gửi yêu cầu /api/batches/..%2Fruns-other/runs/a/b/c/1 tới route runs gần dòng 176. Việc được coi là xong khi kiểm tra so sánh với thư mục gốc có ranh giới ký tự phân tách đường dẫn (hoặc dùng path.relative) và yêu cầu tới thư mục anh em trả về lỗi thay vì tệp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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;
- Ngôn ngữ chính
- TypeScript
- Star
- 10.1k
- Fork
- 527
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 186
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ClickHouse/ClickStack
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several argumentsCó thể đã có người làm @CG-5228 đã nhận 26 ngày trước. Đang mởexternal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/ClickStack#3477 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limitCó thể đã có người làm @Tyagiquamar đã nhận 27 ngày trước. Đang mởalerting bug external
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/ClickStack#3452 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
check-alerts worker: 13 error spans (mongodb.create, NamespaceExists) every minute because mongoose autoCreate is still onCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug external Needs Feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ClickHouse/ClickStack#3308 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
count_distinct aggFn on metric tiles ignores valueExpression, always counts distinct metric ValuesCó thể đã có người làm @Harshul1484 đã nhận 54 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ClickHouse/ClickStack#2311 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement Needs Feedback
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
ClickHouse/ClickStack#3687 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của ClickHouse/ClickStack
Issue tương tự
-
Add: GTrekkerĐang mởcheck:passed streams:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: ui Bug Payload OSS
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
payloadcms/payload#19839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(auth): add the email OTP verification step to Pollar loginCó thể đã có người làm @akansnoro đã nhận hôm nay. Đang mởStellar Wave
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
safetrustcr/dApp-SafeTrust#584 · 10 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The manager preset saves launch definitions without the required file and digest pairCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày