-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into task/system-text-json-…
…migration
- Loading branch information
Showing
7 changed files
with
73 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Lombiq.HelpfulLibraries.AspNetCore/Security/XWidgetsContentSecurityPolicyProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.AspNetCore.Http; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using static Lombiq.HelpfulLibraries.AspNetCore.Security.ContentSecurityPolicyDirectives; | ||
|
||
namespace Lombiq.HelpfulLibraries.AspNetCore.Security; | ||
|
||
/// <summary> | ||
/// An optional content security policy provider that provides configuration to allow the usage of X (Twitter) social | ||
/// widgets. | ||
/// </summary> | ||
public class XWidgetsContentSecurityPolicyProvider : IContentSecurityPolicyProvider | ||
{ | ||
private const string PlatformDotTwitter = "platform.twitter.com"; | ||
|
||
public ValueTask UpdateAsync(IDictionary<string, string> securityPolicies, HttpContext context) | ||
{ | ||
CspHelper.MergeValues(securityPolicies, FrameSrc, PlatformDotTwitter); | ||
CspHelper.MergeValues(securityPolicies, ImgSrc, PlatformDotTwitter, "syndication.twitter.com"); | ||
CspHelper.MergeValues(securityPolicies, StyleSrc, PlatformDotTwitter); | ||
CspHelper.MergeValues(securityPolicies, ScriptSrc, PlatformDotTwitter); | ||
|
||
return ValueTask.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters