CSP: frame-src van de site-policy zonder 'self' (alleen de ingestelde derde partijen)
Continuous Integration / config-sls (pull_request) Successful in 9s
Continuous Integration / config-asf (pull_request) Successful in 7s
Continuous Integration / changes (pull_request) Successful in 30s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / backend-build (pull_request) Successful in 1m0s
Continuous Integration / compile-sites (pull_request) Successful in 1m14s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m17s
Continuous Integration / backend-test (pull_request) Successful in 3m8s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped
Continuous Integration / config-sls (pull_request) Successful in 9s
Continuous Integration / config-asf (pull_request) Successful in 7s
Continuous Integration / changes (pull_request) Successful in 30s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / backend-build (pull_request) Successful in 1m0s
Continuous Integration / compile-sites (pull_request) Successful in 1m14s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m17s
Continuous Integration / backend-test (pull_request) Successful in 3m8s
Continuous Integration / publish-sls-test (pull_request) Skipped
Continuous Integration / publish-sls-production (pull_request) Skipped
Continuous Integration / deploy-sls-test (pull_request) Skipped
Continuous Integration / deploy-sls-production (pull_request) Skipped
Continuous Integration / publish-asf-test (pull_request) Skipped
Continuous Integration / deploy-asf-test (pull_request) Skipped
Continuous Integration / smoke-sls-test (pull_request) Skipped
Continuous Integration / smoke-asf-test (pull_request) Skipped
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,11 +154,11 @@ public class StrictSiteFrameSourceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithFrameOrigins_FrameSrcListsSelfAndThemOnly_BeforeObjectSrc()
|
||||
public void WithFrameOrigins_FrameSrcListsThemOnly_WithoutSelf_BeforeObjectSrc()
|
||||
{
|
||||
var set = CspPolicyCatalog.Build(CspPolicyCatalog.StrictSite, [], [], null, null, [Global, Eu + "/"]);
|
||||
|
||||
set.ContentSecurityPolicy.Should().Contain($"frame-src 'self' {Global} {Eu}; object-src 'none'");
|
||||
set.ContentSecurityPolicy.Should().Contain($"frame-src {Global} {Eu}; object-src 'none'");
|
||||
set.ContentSecurityPolicy.Should().Contain("frame-ancestors 'none'");
|
||||
set.FrameOptions.Should().Be("DENY");
|
||||
}
|
||||
@@ -201,6 +201,6 @@ public class StrictSiteFrameSourceTests
|
||||
using var provider = services.BuildServiceProvider();
|
||||
|
||||
provider.GetRequiredService<ICspPolicyProvider>().Get(CspPolicyCatalog.StrictSite)
|
||||
.ContentSecurityPolicy.Should().Contain($"frame-src 'self' {Global};");
|
||||
.ContentSecurityPolicy.Should().Contain($"frame-src {Global};");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ public static class CspPolicyCatalog
|
||||
.Where(origin => !string.IsNullOrWhiteSpace(origin)).ToArray();
|
||||
if (frames.Length > 0)
|
||||
{
|
||||
directives.Add($"frame-src {Join("'self'", frames)}");
|
||||
// No 'self': a website that embeds only a third party (the captcha widget) frames nothing of its own.
|
||||
directives.Add($"frame-src {Join(string.Empty, frames).Trim()}");
|
||||
}
|
||||
|
||||
directives.AddRange(
|
||||
|
||||
@@ -74,7 +74,7 @@ public sealed class SecurityHeadersOptions
|
||||
/// <summary>
|
||||
/// Origins added as a <c>frame-src</c> directive under the <c>StrictSite</c> policy only (for example the Friendly
|
||||
/// Captcha widget, which renders in an iframe: <c>https://global.frcapi.com</c>, <c>https://eu.frcapi.com</c>).
|
||||
/// Empty (the default) adds no <c>frame-src</c> at all, so existing headers are unchanged.
|
||||
/// Empty (the default) adds no <c>frame-src</c> at all, so existing headers are unchanged. The directive lists exactly these origins, without <c>'self'</c>.
|
||||
/// </summary>
|
||||
public IList<string> AllowedSiteFrameOrigins { get; set; } = [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user