diff --git a/BTCPayServer.Abstractions/Services/Safe.cs b/BTCPayServer.Abstractions/Services/Safe.cs index 8ddb7b9a4..cb8a22d82 100644 --- a/BTCPayServer.Abstractions/Services/Safe.cs +++ b/BTCPayServer.Abstractions/Services/Safe.cs @@ -1,3 +1,4 @@ +using System.Web; using Ganss.XSS; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; @@ -21,6 +22,10 @@ namespace BTCPayServer.Abstractions.Services { return _htmlHelper.Raw(_htmlSanitizer.Sanitize(value)); } + public IHtmlContent RawEncode(string value) + { + return _htmlHelper.Raw(HttpUtility.HtmlEncode(_htmlSanitizer.Sanitize(value))); + } public IHtmlContent Json(object model) { diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml index aef4b0324..75155095b 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml @@ -1,6 +1,8 @@ @using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services @using Newtonsoft.Json.Linq; +@using BTCPayServer.Abstractions.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers @inject DisplayFormatter DisplayFormatter @inject BTCPayServer.Security.ContentSecurityPolicies Csp @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @@ -63,15 +65,15 @@ ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; buttonText = buttonText.Replace("{0}", formatted).Replace("{Price}", formatted); - -
@Safe.Raw(item.Description)
+@Safe.RawEncode(item.Description)
}