fix(network): a URL in SERVER_ADDRESS passes validation but builds an invalid ws URL

Abierto
#488 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
67/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
networking

Línea de trabajo

Start with modules/network/src/client/client-session.ts and modules/network/src/client/config.client.network.ts, then compare the accepted address formats with the network documentation at docs/docs/network/index.mdx. Check how the client constructs its WebSocket URL for a host, a URL with a scheme, and an IPv6 address. Done when accepted addresses produce valid WebSocket URLs and the documentation matches the supported formats.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug documentation modules:network
Which package is this bug report for?

network

Issue description

The client config accepts ws / wss / http / https URLs and the docs say "IP address or URL", but the client then prefixes a scheme and appends a port: https://game.example.com becomes ws://https://game.example.com:4445. IPv6 addresses are not bracketed either. A setup the docs describe cannot connect.

Where:

Evidence:

@IsIpOrURL(undefined, undefined, { protocols: ["ws", "wss", "http", "https"] })
...
const url = `ws${wss ? "s" : ""}://${ip}:${port}`;

Suggested fix: Parse SERVER_ADDRESS with URL and take the scheme from it, or accept only bare hosts (in the validator and the docs). Bracket IPv6 addresses.

Found during a code audit of main at be72076.

Code sample

No response

Versions
  • Engine main at be72076
  • pnpm 12.0.0, Node.js 26, Bun 1.3.14
Issue priority

Medium (should be fixed soon)

I have tested this issue on a development release

be72076

Lenguaje dominante
TypeScript
Estrellas
7
Forks
2
Merge medio
1 d 17 h
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NanoForge-dev/Engine

Todos los issues de NanoForge-dev/Engine

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.