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

Ouverte
#488 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é
3/5
Temps estimé
1-2 jours
Accessibilité débutants
67/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
node.js, typescript
Domaine
networking

Piste de recherche

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.

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

Description

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

Langage dominant
TypeScript
Étoiles
7
Forks
2
Merge moyen
1 j 17 h
PR mergées (30 j)
17

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 NanoForge-dev/Engine

Toutes les issues de NanoForge-dev/Engine

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.