Skip to content

Commit

Permalink
bugfix: avoid XSS in customer address selector and some ticket forms …
Browse files Browse the repository at this point in the history
…(LMS #1910)
  • Loading branch information
chilek committed Jan 17, 2021
1 parent 026e394 commit 9a32448
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion js/lms-ui-iconselectmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $.widget( "custom.iconselectmenu", $.ui.selectmenu, {
'>');
var wrapper = '<div>' + (item.element.attr("data-icon") ? '<i class="' +
(item.element.attr("data-class") ? item.element.attr("data-class") : '') +
' ' + item.element.attr("data-icon") + '"></i>' : '') + item.label + '</div>';
' ' + item.element.attr("data-icon") + '"></i>' : '') + escapeHtml(item.label) + '</div>';

return li.append(wrapper).appendTo(ul);
},
Expand Down
3 changes: 2 additions & 1 deletion templates/default/customer/customeraddresses.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
{/if}
<option value="{$address_id}" data-territ="{if empty($address.teryt)}0{else}1{/if}" data-icon="{$icon}"
{if (isset($selected_address_id) && $selected_address_id == $address_id)
|| (!isset($selected_address_id) && (!isset($preselection) || $preselection) && isset($address.default_address))} selected{/if}>{$address.location}</option>
|| (!isset($selected_address_id) && (!isset($preselection) || $preselection) && isset($address.default_address))} selected{/if}
>{$address.location|escape}</option>
{/foreach}
{/if}
</select>
2 changes: 1 addition & 1 deletion templates/default/rt/rtmessageadd.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <H1>{$layout.pagetitle}</H1>
<INPUT type="hidden" name="message[customerid]" value ="{$message.customerid}">
{box_container id="message"}
{box_header icon="img/mail.gif" label="Subject:"}
<INPUT type="text" size="75" name="message[subject]" maxlength="255" value="{$message.subject}" {tip text="Enter message subject" trigger="subject"}>
<INPUT type="text" size="75" name="message[subject]" maxlength="255" value="{$message.subject|escape}" {tip text="Enter message subject" trigger="subject"}>
{/box_header}

{box_contents}
Expand Down
38 changes: 20 additions & 18 deletions templates/default/rt/rtticketinfobox.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<i class="lms-ui-icon-content lms-ui-icon-user"></i>{trans("Created by:")}
</TD>
<TD style="width: 99%;">
<A href="?m=userinfo&amp;id={$ticket.creatorid}">{$ticket.creator}</a>
<A href="?m=userinfo&amp;id={$ticket.creatorid}">{$ticket.creator|escape}</a>
</TD>
</TR>
{/if}
Expand Down Expand Up @@ -258,7 +258,7 @@
<i class="lms-ui-icon-content lms-ui-icon-location"></i>{trans("Location:")}
</TD>
<TD>
{$ticket.location}
{$ticket.location|escape}
</TD>
</TR>
{/if}
Expand All @@ -280,7 +280,7 @@
<i class="lms-ui-icon-content lms-ui-icon-netnode"></i>{trans("Network Device Node:")}
</TD>
<TD>
<A href="?m=netnodeinfo&id={$ticket.netnodeid}">{$ticket.netnode_name}</A>
<A href="?m=netnodeinfo&id={$ticket.netnodeid}">{$ticket.netnode_name|escape}</A>
</TD>
</TR>
{/if}
Expand All @@ -290,7 +290,7 @@
<i class="lms-ui-icon-content lms-ui-icon-netdev"></i>{trans("Device:")}
</TD>
<TD>
<A href="?m=netdevinfo&id={$ticket.netdevid}">{$ticket.netdev_name}</A>
<A href="?m=netdevinfo&id={$ticket.netdevid}">{$ticket.netdev_name|escape}</A>
</TD>
</TR>
{/if}
Expand All @@ -300,7 +300,7 @@
{icon name="invproject" label="Investment project:"}
</TD>
<TD>
{$ticket.invproject_name}</A>
{$ticket.invproject_name|escape}</A>
</TD>
</TR>
{/if}
Expand All @@ -310,30 +310,32 @@
{icon name="parentticket" label="Parent ticket:"}
</TD>
<TD>
#{$ticket.parent.id|string_format:"%06d"} <a href="?m=rtticketview&id={$ticket.parent.id}">{$ticket.parent.name}</a><br>
#{$ticket.parent.id|string_format:"%06d"} <a href="?m=rtticketview&id={$ticket.parent.id}">{$ticket.parent.name|escape}</a><br>
</TD>
</TR>
{/if}
{if $ticket.childtickets}
<TR>
<TD class="bold">
{icon name="childticket" label="Child tickets:"}
</TD>
<TD>
{foreach $ticket.childtickets as $t}
#{$t.id|string_format:"%06d"} <a href="?m=rtticketview&id={$t.id}">{$t.subject}</a><br>
{/foreach}
</TD>
</TR>
{/if}
<TR>
<TD class="bold">
{icon name="childticket" label="Child tickets:"}
</TD>
<TD>
{foreach $ticket.childtickets as $t}
#{$t.id|string_format:"%06d"}
<a href="?m=rtticketview&id={$t.id}">{$t.subject|escape}</a>
<br>
{/foreach}
</TD>
</TR>
{/if}
{if $ticket.relatedtickets}
<TR>
<TD class="bold nobr">
{icon name="relatedticket" label="Related tickets:"}
</TD>
<TD>
{foreach $ticket.relatedtickets as $i}
#{$i.id|string_format:"%06d"} <a href="?m=rtticketview&id={$i.id}">{$i.name}</a><br>
#{$i.id|string_format:"%06d"} <a href="?m=rtticketview&id={$i.id}">{$i.name|escape}</a><br>
{/foreach}
</TD>
</TR>
Expand Down

0 comments on commit 9a32448

Please sign in to comment.