diff --git a/lms/static/js/learner_dashboard/views/course_entitlement_view.js b/lms/static/js/learner_dashboard/views/course_entitlement_view.js index 3f2e65f4c28d..690a9c59fa54 100644 --- a/lms/static/js/learner_dashboard/views/course_entitlement_view.js +++ b/lms/static/js/learner_dashboard/views/course_entitlement_view.js @@ -90,6 +90,15 @@ class CourseEntitlementView extends Backbone.View { }); } + escapeHtml(unsafe) { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + } + handleEnrollChange() { /* Handles enrolling in a course, unenrolling in a session and changing session. diff --git a/lms/templates/learner_dashboard/course_card.underscore b/lms/templates/learner_dashboard/course_card.underscore index f15b7c4881bd..485f94adabf1 100644 --- a/lms/templates/learner_dashboard/course_card.underscore +++ b/lms/templates/learner_dashboard/course_card.underscore @@ -5,10 +5,10 @@
<% if (course_title_link) { %> - <%- title %> + <%- escapeHtml(title) %> <% } else { %> - <%- title %> + <%- escapeHtml(title) %> <% } %>