Skip to content

Unhandled Promise Rejection on ALB event #678

Open
@repl-ullas-ml

Description

@repl-ullas-ml

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

path: getPathWithQueryStringUseUnescapeParams({ event })

query[formattedKey] = event.multiValueQueryStringParameters[key].map(value => decodeUrlencoded(value))

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')
  })

Screenshot 2024-04-23 at 11 34 20 AM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions