The eval viewer's safeJoin allows a sibling directory sharing the runs prefix
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 72/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, nodejs
Direção de pesquisa
O bug está em safeJoin, em packages/hdx-eval/scripts/viewer/server.js (por volta da linha 39), que usa uma verificação startsWith simples sobre a raiz resolvida. Para reproduzir, crie um diretório irmão runs-other e faça a requisição /api/batches/..%2Fruns-other/runs/a/b/c/1 na rota de runs, perto da linha 176. Está concluído quando a verificação compara com a raiz usando um limite de separador de caminho (ou usa path.relative) e a requisição ao diretório irmão retorna um erro em vez do arquivo.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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;
- Linguagem predominante
- TypeScript
- Estrelas
- 10.1k
- Forks
- 527
- Merge médio
- 1d 20h
- PRs com merge (30d)
- 186
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ClickHouse/ClickStack
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several argumentsTalvez já em andamento @CG-5228 assumiu há 26 dias. Abertaexternal
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
ClickHouse/ClickStack#3477 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limitTalvez já em andamento @Tyagiquamar assumiu há 27 dias. Abertaalerting bug external
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
ClickHouse/ClickStack#3452 ·
Mantenedores costumam responder em até 1 dia
-
check-alerts worker: 13 error spans (mongodb.create, NamespaceExists) every minute because mongoose autoCreate is still onTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Abertabug external Needs Feedback
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
ClickHouse/ClickStack#3308 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
count_distinct aggFn on metric tiles ignores valueExpression, always counts distinct metric ValuesTalvez já em andamento @Harshul1484 assumiu há 54 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
ClickHouse/ClickStack#2311 ·
Mantenedores costumam responder em até 1 dia
-
enhancement Needs Feedback
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
ClickHouse/ClickStack#3687 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de ClickHouse/ClickStack
Issues semelhantes
-
Add: GTrekkerAbertacheck:passed streams:add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
area: ui Bug Payload OSS
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
payloadcms/payload#19839 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
fix(auth): add the email OTP verification step to Pollar loginTalvez já em andamento @akansnoro assumiu hoje. AbertaStellar Wave
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
safetrustcr/dApp-SafeTrust#584 · 10 comentários ·
Mantenedores costumam responder em até 1 dia
-
The manager preset saves launch definitions without the required file and digest pairTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
Mantenedores costumam responder em até 1 dia