Security hardening: Next.js patch release, MCP SDK advisories, pre-auth body size, CSP, readonly gaps

Aberta
#3,491 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
clickhouse, express, next.js, typescript
Domínio
api, backend, security

Direção de pesquisa

Start by reviewing api-app.ts for the global body parsers, next.config.mjs for response headers, and routers/external-api/v2/utils/search.ts for SQL settings; inspect the MCP SDK and builder-config alert paths described in the issue as well. Check the existing Next.js bump in #3460 and dependency audit findings. Done means the release and each security gap described here are addressed and verified, including appropriate body limits, headers, and readonly settings.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

external

Found while reviewing a self-hosted @hyperdx/[email protected] deployment. None of these depend on our local changes.

1. Latest release ships Next.js 16.3.8

2.42.0 pins [email protected], which is inside the range of the Next.js 16.4.1 security release (>=16.0.0 <=16.4.0). main already has the bump (#3460). Could that go out in a patch release? Self-hosters on the latest tag are exposed until then.

2. @modelcontextprotocol/sdk 1.29.0 has open advisories

Both 2.42.0 and main resolve 1.29.0. yarn npm audit reports advisories fixed in 1.30.1–1.32.0, including missing request-body and JSON-RPC batch limits on the HTTP transport and memory exhaustion during validation. /mcp is internet-facing in many deployments.

3. Request bodies up to 32 MB are parsed before authentication

api-app.ts mounts express.json, express.text and express.urlencoded with limit: '32mb' globally, ahead of every auth check and rate limiter. Any unauthenticated client can make the API parse 32 MB bodies on any route. A small default limit, with the large limit only on the routes that need it (e.g. the ClickHouse proxy), would close this.

4. No Content-Security-Policy or related headers

next.config.mjs sets only X-Frame-Options: DENY. There is no CSP, X-Content-Type-Options: nosniff, Referrer-Policy or HSTS, and the API sets none either. I found no current XSS sink, so this is defence in depth.

5. Some server-side user-SQL paths do not force readonly=2

The MCP SQL tool and dashboard SQL tiles force readonly=2, but external API v2 search / charts (routers/external-api/v2/utils/search.ts) and builder-config alerts run a user-supplied whereLanguage: 'sql' condition without it. They are always a single SELECT, so I found no escalation, but passing clickhouse_settings: { readonly: '2' } there would make the guarantee uniform.

Linguagem predominante
TypeScript
Estrelas
10.1k
Forks
527
Merge médio
1d 20h
PRs com merge (30d)
186

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de ClickHouse/ClickStack

Todas as issues de ClickHouse/ClickStack

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.