From 15ef27fe0f97b2338a853822a6d7f310d166372d Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Tue, 15 Mar 2016 12:44:57 -0400 Subject: [PATCH 1/3] Escape full name TNL-3849/SEC-69 --- lms/templates/verify_student/pay_and_verify.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/verify_student/pay_and_verify.html b/lms/templates/verify_student/pay_and_verify.html index 0f862a682f..4b3a99e609 100644 --- a/lms/templates/verify_student/pay_and_verify.html +++ b/lms/templates/verify_student/pay_and_verify.html @@ -58,7 +58,7 @@ from lms.djangoapps.verify_student.views import PayAndVerifyView
Date: Tue, 15 Mar 2016 09:32:10 -0400 Subject: [PATCH 2/3] Properly escape the name --- lms/templates/instructor/instructor_dashboard_2/metrics.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/templates/instructor/instructor_dashboard_2/metrics.html b/lms/templates/instructor/instructor_dashboard_2/metrics.html index 7aae9338ae..5eee8e05e1 100644 --- a/lms/templates/instructor/instructor_dashboard_2/metrics.html +++ b/lms/templates/instructor/instructor_dashboard_2/metrics.html @@ -91,7 +91,7 @@ from django.template.defaultfilters import escapejs $('.metrics-overlay-content thead', metrics_overlay).append(overlay_content); $.each(response.results, function(index, value ){ - overlay_content = '' + value['name'] + "" + value['username'] + ''; + overlay_content = '' + _.escape(value['name']) + "" + _.escape(value['username']) + ''; $('.metrics-overlay-content tbody', metrics_overlay).append(overlay_content); }); // If student list too long, append message to screen. @@ -131,7 +131,7 @@ from django.template.defaultfilters import escapejs $('.metrics-overlay-content thead', metrics_overlay).append(overlay_content); $.each(response.results, function(index, value ){ - overlay_content = '' + value['name'] + "" + value['username'] + "" + value['grade'] + "" + value['percent'] + ''; + overlay_content = '' + _.escape(value['name']) + "" + _.escape(value['username']) + "" + _.escape(value['grade']) + "" + _.escape(value['percent']) + ''; $('.metrics-overlay-content tbody', metrics_overlay).append(overlay_content); }); // If student list too long, append message to screen. From 90a72ddba690c99f10d0e044cc30bf0637d1292d Mon Sep 17 00:00:00 2001 From: Ayub-khan Date: Wed, 16 Mar 2016 18:57:45 +0500 Subject: [PATCH 3/3] Properly escaping fullname To prevent XSS attacks, we now properly escape any string containing the user's fullname. Enumerated by searching webview.py for "fullname", and "git grep"-ing any occurrences. This also exposed some unused strings, which I deleted for clarity. --- lms/templates/certificates/_accomplishment-banner.html | 2 +- lms/templates/certificates/_accomplishment-rendering.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lms/templates/certificates/_accomplishment-banner.html b/lms/templates/certificates/_accomplishment-banner.html index 2ca86733c3..eba7ee8d9c 100644 --- a/lms/templates/certificates/_accomplishment-banner.html +++ b/lms/templates/certificates/_accomplishment-banner.html @@ -40,7 +40,7 @@ from django.template.defaultfilters import escapejs