From 86913938268073a5ae9eeed63461c66c9924fd41 Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Tue, 15 Mar 2016 12:44:57 -0400 Subject: [PATCH 1/4] 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 6c1882ff1d..7ea4f6ac27 100644 --- a/lms/templates/verify_student/pay_and_verify.html +++ b/lms/templates/verify_student/pay_and_verify.html @@ -59,7 +59,7 @@ from lms.djangoapps.verify_student.views import PayAndVerifyView
Date: Tue, 15 Mar 2016 09:32:10 -0400 Subject: [PATCH 2/4] 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 f0e7dcd346f1b17505897bbe7b20365c88f51757 Mon Sep 17 00:00:00 2001 From: Ayub-khan Date: Wed, 16 Mar 2016 18:57:45 +0500 Subject: [PATCH 3/4] 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