CodeGenieApp / CodeGenieApp/serverless-express
Unhandled Promise Rejection on ALB event
- Lingua principale
- JavaScript
- Stelle
- 5.3k
- Fork
- 676
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Given an ALB event with multiValueQueryStringParameters but one of the value fails `decodeURIComponent` , the promise isnt handled at all. Expectation is that it should return an error and consumers treat that error
https://github.com/CodeGenieApp/serverless-express/blob/1376bd01e29f6bcf911f86a2b17a5cb85b2844ec/src/event-sources/aws/alb.js#L40
https://github.com/CodeGenieApp/serverless-express/blob/1376bd01e29f6bcf911f86a2b17a5cb85b2844ec/src/event-sources/aws/alb.js#L17
The below test wont even report the failure since the promise is left unhandled
```
test('serverlessExpressInstance should throw', async () => {
const multiValueQueryStringParameters = { etype: ['odp'], passurl: ['/category/'], template: ['../../../../../../../../../etc/passwd%%0000.html'] }
const event = makeEvent({
eventSourceName: 'alb',
path: '/',
httpMethod: 'GET',
multiValueQueryStringParameters
})
await expect(serverlessExpressInstance(event)).toThrow('some')
})
```

Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in src/event-sources/aws/alb.js, nella gestione referenziata dei parametri di query e nelle righe di elaborazione degli eventi, quindi riproduci il caso con un valore di multiValueQueryStringParameters che faccia fallire decodeURIComponent. Aggiorna il comportamento in modo che il fallimento venga restituito come un errore che i consumer possano gestire, e verifica che il test serverlessExpressInstance fornito segnali il rifiuto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, javascript, node.js
- Ambito
- backend, cloud
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100