From 0b9b3446da234044684997c8fdf0a7ab60933bf3 Mon Sep 17 00:00:00 2001 From: Dennis Griffin Date: Thu, 26 May 2022 11:36:55 -0400 Subject: [PATCH 1/3] Fixed XSS vulnerability in the click event of 'button.addComment'. See lines 74 and 75. --- public/client.js | 148 ++++++++++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 61 deletions(-) diff --git a/public/client.js b/public/client.js index 2cda6a53..79024de5 100644 --- a/public/client.js +++ b/public/client.js @@ -1,85 +1,111 @@ -$( document ).ready(function() { - let items = []; - let itemsRaw = []; - - $.getJSON('/api/books', function(data) { +$(document).ready(function () { + let items = []; + let itemsRaw = []; + + $.getJSON("/api/books", function (data) { //let items = []; itemsRaw = data; - $.each(data, function(i, val) { - items.push('
  • ' + val.title + ' - ' + val.commentcount + ' comments
  • '); - return ( i !== 14 ); + $.each(data, function (i, val) { + items.push( + '
  • ' + + val.title + + " - " + + val.commentcount + + " comments
  • " + ); + return i !== 14; }); if (items.length >= 15) { - items.push('

    ...and '+ (data.length - 15)+' more!

    '); + items.push("

    ...and " + (data.length - 15) + " more!

    "); } - $('