shreemaan-abhishek opened a new pull request, #13798:
URL: https://github.com/apache/apisix/pull/13798

   ### Description
   
   The `openfunction`, `aws-lambda` and `azure-functions` plugins share 
`apisix/plugins/serverless/generic-upstream.lua`. It forwarded every inbound 
client header verbatim, including `Transfer-Encoding`, while separately 
supplying the request body already **de-chunked** by nginx 
(`ngx.req.get_body_data()`).
   
   `resty.http` then keeps `Transfer-Encoding: chunked`, drops 
`Content-Length`, and writes the (now unframed) body raw without re-chunking. 
The forwarded upstream request advertises chunked framing over a body that has 
none, so the framing header and the body disagree on message length. Against a 
keep-alive backend this can desync the connection and lead to request smuggling 
on the pooled upstream socket.
   
   Fix: strip the client's `Transfer-Encoding` and `Content-Length` before 
forwarding, so the HTTP client recomputes a correct `Content-Length` from the 
actual body and never emits chunked framing over an unframed body. The strip 
happens before each plugin's request processor, so `aws-lambda` SigV4 signs a 
clean header set.
   
   Added an end-to-end regression test in `t/plugin/aws-lambda.t`: a chunked 
client request through the plugin, asserting the upstream receives no 
`Transfer-Encoding` and an intact, correctly framed body.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to