kohabug 2026 - HTML-escape comments
This is a partial, perhaps temporary fix. "<", ">", and "&" characters in patron comments (AKA reviews) are converted to "<", ">", and "&" to avoid certain attacks, e.g., a user entering a <script> tag in a comment. A more permanent fix should scrub all (or perhaps just unsafe) tags from submitted comments entirely. Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
438ed23337
commit
60983cfeee
|
|
@ -58,7 +58,7 @@ $.tablesorter.addParser({
|
|||
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="bibliotitle" --></a>
|
||||
</td>
|
||||
<td>
|
||||
<!-- TMPL_VAR NAME="review" -->
|
||||
<!-- TMPL_VAR NAME="review" ESCAPE="HTML" -->
|
||||
</td>
|
||||
<td>
|
||||
<a href="/cgi-bin/koha/reviews/reviewswaiting.pl?op=approve&reviewid=<!-- TMPL_VAR NAME="reviewid" -->">Approve</a> |
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
<!--TMPL_VAR NAME="datereviewed"-->
|
||||
</small>
|
||||
<p>
|
||||
<!--TMPL_VAR NAME="review"-->
|
||||
<!--TMPL_VAR NAME="review" ESCAPE="HTML"-->
|
||||
</p>
|
||||
<!--/TMPL_LOOP-->
|
||||
<!-- TMPL_ELSE -->
|
||||
|
|
@ -185,4 +185,4 @@
|
|||
</div>
|
||||
<!-- TMPL_IF NAME="OpacNav" --><div class="yui-b"><!--TMPL_INCLUDE NAME="navigation.inc" --></div><!-- /TMPL_IF -->
|
||||
</div>
|
||||
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
|
||||
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@
|
|||
</h5>
|
||||
<small><!-- TMPL_VAR NAME="datereviewed" --></small>
|
||||
<p>
|
||||
<!-- TMPL_VAR NAME="review" -->
|
||||
<!-- TMPL_VAR NAME="review" ESCAPE="HTML" -->
|
||||
<a href="#" onclick="Dopop('/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&reviewid=<!-- TMPL_VAR NAME="reviewid" -->');">Edit</a>
|
||||
</p></div>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
|
@ -432,7 +432,7 @@
|
|||
</h5>
|
||||
<small><!-- TMPL_VAR NAME="datereviewed" --></small>
|
||||
<p>
|
||||
<!-- TMPL_VAR NAME="review" -->
|
||||
<!-- TMPL_VAR NAME="review" ESCAPE="HTML" -->
|
||||
</p></div>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_LOOP -->
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
$('#reviewf').submit( function() {
|
||||
<!-- TMPL_IF NAME="reviewid" -->
|
||||
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').prev("small").prev("h5").html("Your Edited Comment (preview, pending approval)");
|
||||
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').html($("#review").val());
|
||||
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').html($("#review").val().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'));
|
||||
parent.opener.$('#c<!-- TMPL_VAR NAME="reviewid" --> p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&reviewid=<!-- TMPL_VAR NAME="reviewid" -->\');\">Edit</a>");
|
||||
window.close();
|
||||
<!-- TMPL_ELSE -->
|
||||
parent.opener.$('#newcomment').attr("class","yours");
|
||||
parent.opener.$('#newcomment').html("<h5>Your Comment (preview, pending approval)</h5>");
|
||||
parent.opener.$('#newcomment').append("<p>"+$("#review").val());
|
||||
parent.opener.$('#newcomment').append("<p>"+$("#review").val().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'));
|
||||
parent.opener.$('#newcomment p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber"-->&reviewid=<!-- TMPL_VAR NAME="reviewid" -->\');\">Edit</a></p>");
|
||||
parent.opener.$("#addcomment").prev("p").remove();
|
||||
parent.opener.$("#addcomment").remove();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!--TMPL_VAR NAME="review"-->
|
||||
<!--TMPL_VAR NAME="review" ESCAPE="HTML"-->
|
||||
<p><!--TMPL_VAR NAME="datereviewed"--></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue