The vulnerability is a Server-Side Request Forgery (SSRF) caused by insufficient validation of the x-portkey-custom-host request header. The analysis of the patch commit b5a7825ba5f4e6918deb32d9969899ce2229a885 reveals two key locations where this weak validation occurred.
The primary vulnerable function is requestValidator in src/middlewares/requestValidator/index.ts. This middleware directly handled the incoming HTTP request and checked the custom host header. The original code only blocked hosts containing 'api.portkey', leaving the application open to requests to internal network resources or cloud metadata services.
Additionally, a similar flawed validation logic was found within a .refine() call on the configSchema in src/middlewares/requestValidator/schema/config.ts. This schema validation also used the same weak check, reinforcing the vulnerability.
The patch rectifies this by introducing a new, robust validation function, isValidCustomHost, which is now called by both requestValidator and the configSchema. This new function implements a proper security model by checking against private/reserved IP ranges, disallowed URL schemes, and other patterns indicative of an SSRF attack, effectively mitigating the vulnerability.