Merge pull request #2258 from divinity76/patch-5

fix xss / GH-2252
This commit is contained in:
Anton Reutov 2022-07-27 13:46:51 +03:00 committed by GitHub
commit 51e468c22f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1191,6 +1191,13 @@ class UploadHandler
));
}
}
if(!headers_sent()){
// this is the most likely/expected path.
header("Content-Type: application/json");
} else {
// html-encode json to prevent xss...
$json = htmlentities($json, ENT_QUOTES | ENT_SUBSTITUTE | ENT_DISALLOWED | ENT_HTML401);
}
$this->body($json);
}
return $content;