mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
Fix interactive XSS when entering javascript: in store's website.
This commit is contained in:
parent
c4f4c3138c
commit
7f40698bba
@ -86,6 +86,7 @@ namespace BTCPayServer.TagHelpers
|
||||
}
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
bool cspAllow = output.Attributes.RemoveAll("csp-allow");
|
||||
foreach (var attr in output.Attributes)
|
||||
{
|
||||
var n = attr.Name.ToLowerInvariant();
|
||||
@ -96,7 +97,7 @@ namespace BTCPayServer.TagHelpers
|
||||
else if (n == "href")
|
||||
{
|
||||
var v = attr.Value.ToString();
|
||||
if (v.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase))
|
||||
if (v.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase) && cspAllow)
|
||||
{
|
||||
Allow(v);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<p>Insert your security key into your computer's USB port. If it has a button, tap on it.</p>
|
||||
</div>
|
||||
<p id="error-message" class="d-none alert alert-danger"></p>
|
||||
<a id="btn-retry" class="btn btn-secondary d-none" href="javascript:window.location.reload()">Retry</a>
|
||||
<a id="btn-retry" class="btn btn-secondary d-none" href="javascript:window.location.reload()" csp-allow>Retry</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<p>Insert your security key into your computer's USB port. If it has a button, tap on it.</p>
|
||||
</div>
|
||||
<p id="error-message" class="d-none alert alert-danger"></p>
|
||||
<a id="btn-retry" class="btn btn-secondary d-none" href="javascript:window.location.reload()">Retry</a>
|
||||
<a id="btn-retry" class="btn btn-secondary d-none" href="javascript:window.location.reload()" csp-allow>Retry</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -333,7 +333,7 @@
|
||||
</th>
|
||||
<th style="min-width:90px;" class="col-md-auto">
|
||||
Date
|
||||
<a href="javascript:switchTimeFormat()">
|
||||
<a href="javascript:switchTimeFormat()" csp-allow>
|
||||
<span class="fa fa-clock-o" title="Switch date format"></span>
|
||||
</a>
|
||||
</th>
|
||||
@ -411,7 +411,7 @@
|
||||
{
|
||||
<span>
|
||||
<a asp-action="Checkout" class="invoice-checkout-link" id="invoice-checkout-@invoice.InvoiceId" asp-route-invoiceId="@invoice.InvoiceId">Checkout</a>
|
||||
<a href="javascript:btcpay.showInvoice('@invoice.InvoiceId')">[^]</a>
|
||||
<a href="javascript:btcpay.showInvoice('@invoice.InvoiceId')" csp-allow>[^]</a>
|
||||
@if (!invoice.CanMarkStatus)
|
||||
{
|
||||
<span>-</span>
|
||||
|
@ -44,7 +44,7 @@
|
||||
</th>
|
||||
<th width="190px">
|
||||
Date
|
||||
<a href="javascript:switchTimeFormat()">
|
||||
<a href="javascript:switchTimeFormat()" csp-allow>
|
||||
<span class="fa fa-clock-o" title="Switch date format"></span>
|
||||
</a>
|
||||
</th>
|
||||
|
@ -89,7 +89,7 @@
|
||||
<tr>
|
||||
<th style="min-width: 90px;" class="col-md-auto">
|
||||
Date
|
||||
<a href="javascript:switchTimeFormat()">
|
||||
<a href="javascript:switchTimeFormat()" csp-allow>
|
||||
<span class="fa fa-clock-o" title="Switch date format"></span>
|
||||
</a>
|
||||
</th>
|
||||
|
Loading…
Reference in New Issue
Block a user