mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Fix: Impossible to see relative time of transaction in wallet list
This commit is contained in:
parent
ed1ec2300d
commit
6a28497d33
@ -75,14 +75,21 @@ namespace BTCPayServer.Security
|
||||
/// Allow a specific script as event handler
|
||||
/// </summary>
|
||||
/// <param name="script"></param>
|
||||
public void AllowUnsafeHashes(string script)
|
||||
public void AllowUnsafeHashes(string script = null)
|
||||
{
|
||||
if (script is null)
|
||||
throw new ArgumentNullException(nameof(script));
|
||||
var sha = GetSha256(script);
|
||||
Add("script-src", $"'unsafe-hashes'");
|
||||
Add("script-src", $"'sha256-{sha}'");
|
||||
if (!allowUnsafeHashes)
|
||||
{
|
||||
Add("script-src", $"'unsafe-hashes'");
|
||||
allowUnsafeHashes = true;
|
||||
}
|
||||
if (script != null)
|
||||
{
|
||||
var sha = GetSha256(script);
|
||||
Add("script-src", $"'sha256-{sha}'");
|
||||
}
|
||||
}
|
||||
|
||||
bool allowUnsafeHashes = false;
|
||||
/// <summary>
|
||||
/// Allow the injection of script tag with the following script
|
||||
/// </summary>
|
||||
|
@ -136,7 +136,7 @@ namespace BTCPayServer.TagHelpers
|
||||
var v = attr.Value.ToString();
|
||||
if (v.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_csp.AllowInline(v);
|
||||
_csp.AllowUnsafeHashes(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user