Sanitize policy bodies at output in PolicyEndpoint::index (defense-in-depth) #40
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding (security review — Low, defense-in-depth)
assets/js/booking.jsandassets/js/group-classes.jsinject the policybodyfromGET /policiesintoinnerHTMLunescaped, andPolicyEndpoint::index()(src/Policy/PolicyEndpoint.php) returns the stored body verbatim.Safety currently rests entirely on
wp_kses_postbeing applied on every write path — which it is today (RESTaddVersion/updateVersionand the adminPolicyController) — but any future write path that forgets it becomes stored XSS served to every student in the booking/enrolment flow.The server-rendered registration template already applies
wp_kses_postat output (templates/frontend/register-page.php); the REST listing should match.Fix
Run the body through
wp_kses_post()inPolicyEndpoint::index()before returning it. Update the endpoint unit test.