[BUG] NoSQL Injection 1 only answers once per Tomcat run: the servlet closes the shared MongoClient

Aperta Adatta ai principianti
#992 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ismisepaul ci sta già lavorando.

Dal 25/10/2026.

  • #1019 di @ismisepaul — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, mongodb

Direzione di ricerca

Leggi NoSqlInjection1.doPost e MongoDatabase.getMongoDbConnection per confermare che il client è condiviso mentre il cursore è limitato alla richiesta. Rimuovi la chiusura del client e aggiungi un test di integrazione che invii due richieste e si aspetti risultati entrambe le volte; il cursore deve continuare a essere chiuso. Controlla prima le convenzioni esistenti per i test di integrazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Levels

Discovered during #958.

NoSqlInjection1.doPost gets its client from MongoDatabase.getMongoDbConnection(applicationRoot, credential) and calls mongoClient.close() in its finally. Since the pooling work in #816, MongoDatabase caches one client per credential in credentialClients, so the servlet closes the shared client. Every later request fails with IllegalStateException: state should be: open and the player sees "An Error Occurred! You must be getting funky!" until Tomcat restarts.

Reproduced on dev (driver 3.12, MongoDB 4.1.13) and with driver 5.13 / MongoDB 8.0.

Fix: remove the close() on the shared client (the cursor close stays). The injection itself ($where built from user input) is untouched. Add an IT that submits twice and expects results both times.

🤖 Generated with Claude Code

Lingua principale
Java
Stelle
1.5k
Fork
519
Merge medio
1g 1h
PR unite (30g)
61

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OWASP/SecurityShepherd

Tutte le issue di OWASP/SecurityShepherd

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.