Reputation: 49
Lets say you have a front end app sending reqiests to a php backend. On the front end:
fetch("/", {
method: "POST",
body: JSON.stringify({
"data": myData,
})
})
On the backend:
$body = file_get_contents('php://input');
$columns = json_decode($body, true);
if (!is_array($columns)) {
return json_encode("Invalid message body. " . $body);
}
What security considerations do I need to give to accessing file_get_contents('php://input')? Is columns safe to use or do I need to call some function like sanitizeArray($columns), if so does php have a function like sanitizeArray.
Upvotes: 0
Views: 119