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

Ouverte
#3,491 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
clickhouse, express, next.js, typescript
Domaine
api, backend, security

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
TypeScript
Étoiles
10.1k
Forks
527
Merge moyen
1 j 20 h
PR mergées (30 j)
186

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ClickHouse/ClickStack

Toutes les issues de ClickHouse/ClickStack

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.