A client reauth over the same socket should not count against their max connections
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- authentication, networking
Direzione di ricerca
Inizia in lib/listener.js, in Sockets.prototype.auth(), che l'issue identifica come il punto in cui lo stesso socket viene aggiunto all'indice dell'utente durante la riautenticazione. Usa il test di riproduzione dell'issue, con auth.index abilitato e maxConnectionsPerUser impostato su 2. Il lavoro è completato quando riautenticazioni ripetute su un socket aperto non superano il limite di connessioni, mentre le connessioni separate continuano a essere conteggiate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Runtime
node
Runtime version
v24.18.1
Module version
v14.0.1
Last module version without issue
N/A
Used with
hapi application
Any other relevant information
See https://github.com/hapijs/nes/pull/341. I commented with a test that reproduces the issue on master:
it('does not count reauthentication towards the connections limit', async () => {
const server = Hapi.server();
server.auth.scheme('custom', internals.implementation);
server.auth.strategy('default', 'custom');
server.auth.default('default');
await server.register({ plugin: Nes, options: { auth: { index: true, maxConnectionsPerUser: 2 } } });
await server.start();
const client = new Nes.Client(getUri(server.info));
await client.connect({ reconnect: false, auth: { headers: { authorization: 'Custom john' } } });
await client.reauthenticate({ headers: { authorization: 'Custom john' } });
// a reauth is not a new connection
await expect(client.reauthenticate({ headers: { authorization: 'Custom john' } })).to.not.reject();
client.disconnect();
await server.stop();
});
What are you trying to achieve or the steps to reproduce?
With auth.index: true, every reauthenticate() on an open connection pushes the same socket onto the user's index array again. Sockets.prototype.auth() in lib/listener.js doesn't check whether it's already there.
What was the result you got?
Multiple reauths due to token refresh can lead to disconnections due to hitting configured maxConnectionsPerUser when user only has 1 connection open.
An additional side effect is that a broadcast() targeted at a user will cause them to receive duplicate messages due to their socket being duplicated in the _byUser array.
What result did you expect?
I would expect only true connections (multiple tabs open for example) would count towards the limit.
- Lingua principale
- JavaScript
- Stelle
- 502
- Fork
- 85
- Merge medio
- 16g 16h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hapijs/nes
-
Listener does not correctly handle optional & wildcard routes.Forse di nuovo libera @damusix l’ha presa 212 giorni fa e non c’è nessuna pull request aperta. Apertabug
-
support
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Polling option fallbackApertasupport
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
gkjohnson/three-mesh-bvh#933 ·
-
scope: curriculum status: waiting triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
freeCodeCamp/freeCodeCamp#71076 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
HarperFast/harper#3275 ·
I maintainer di solito rispondono entro 1 giorno
-
liveQuery: a late rejection from an aborted (superseded) query run still reaches observer.errorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
steerion-labs/bounded-agent-runtime#93 ·
I maintainer di solito rispondono entro 1 giorno