CodeGenieApp / CodeGenieApp/serverless-express

request.ip property shadows/overrides the Express request.ip property

Open
#713 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

https://github.com/CodeGenieApp/serverless-express/blob/4205db8998b31f4ceef1185c248c2d651d538cb0/src/request.js#L29

This project inspired https://github.com/H4ad/serverless-adapter and as noted in https://github.com/H4ad/serverless-adapter/issues/348, the `request.ip` property defined as part of `ServerlessRequest` while extending `IncomingMessage` shadows the `ip` property defined by Express as noted at https://expressjs.com/en/api.html#req.ip.

As a result, the Express [trust proxy settings](https://expressjs.com/en/guide/behind-proxies.html) has no effect and the `ip` property does not reflect the IP address of the client that originally made the call.

@H4ad noted in the other ticket that he wasn't sure why `ServerlessRequest` defined the `ip` property and what impacts changing/removing it could have. Do you have any information/context that you could sharerequest.ip property shadows/overrides the Express request.ip property

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.