react
react copied to clipboard
Fix region Type confusion through parameter tampering
https://github.com/facebook/react/blob/73f06e04301ab20fe4e07f56de97e3c587e4b2e1/fixtures/flight-esm/server/region.js#L180-L180
To fix the issue, we need to ensure that req.query.name is explicitly validated to be a string before it is used. If it is not a string, the code should handle the case appropriately, such as returning an error response. This can be achieved by adding a type check for req.query.name and rejecting the request if it is not a string.
The changes will be made in the /source-maps route handler:
- Add a type check for
req.query.nameto ensure it is a string. - If
req.query.nameis not a string, return a400 Bad Requestresponse with an appropriate error message.