-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Validate and Sanitize External API Responses Before Forwarding
Directly forwarding the external API's response to the client without validation may pose security risks. The external API could return unexpected or malicious data. It's recommended to parse and validate the response content before sending it to the client to ensure that no harmful or sensitive data is transmitted.
Consider modifying the code to parse the response and safely send it to the client:
- return new NextResponse(response.body, {
- headers: {
- 'Content-Type': 'text/event-stream',
- 'Cache-Control': 'no-cache',
- 'Connection': 'keep-alive',
- },
- });
+ const data = await response.json();
+ return NextResponse.json(data, {
+ headers: {
+ 'Cache-Control': 'no-cache',
+ 'Connection': 'keep-alive',
+ },
+ });Committable suggestion was skipped due to low confidence.
Originally posted by @coderabbitai[bot] in #276 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request