Skip to content

Commit

Permalink
Updated packages and fixed breaking changes (#482)
Browse files Browse the repository at this point in the history
* Updated packages and fixed breaking changes

* Added null check for header value
  • Loading branch information
sam-c-dfe authored Dec 4, 2024
1 parent d6ec706 commit 0762ae2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="moq" Version="4.20.72" />
<PackageReference Include="OwaspHeaders.Core" Version="9.1.1" />
<PackageReference Include="OwaspHeaders.Core" Version="9.4.0" />
<PackageReference Include="RobotsTxtCore" Version="3.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ public static SecureHeadersMiddlewareConfiguration CustomConfiguration()
.UseHsts()
.UseXFrameOptions()
.UseContentTypeOptions()
.UseContentDefaultSecurityPolicy()
.UseDefaultContentSecurityPolicy()
.UsePermittedCrossDomainPolicies()
.UseReferrerPolicy()
.UseCacheControl()
.RemovePoweredByHeader()
.UseXssProtection()
.UseCrossOriginResourcePolicy()
.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="moq" Version="4.20.72"/>
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ public void SecureHeaderConfiguration_ExplicitConfiguration()
config.UseReferrerPolicy.Should().BeTrue();
config.UseExpectCt.Should().BeFalse();
config.UseCacheControl.Should().BeTrue();
config.RemoveXPoweredByHeader.Should().BeTrue();
config.UseCrossOriginResourcePolicy.Should().BeTrue();
config.HstsConfiguration.IncludeSubDomains.Should().BeTrue();
config.HstsConfiguration.MaxAge.Should().Be(31536000);
config.XFrameOptionsConfiguration.OptionValue.Should().Be(XFrameOptions.Deny);
config.HstsConfiguration.Should().NotBeNull();
var hstsHeaderValue = config.HstsConfiguration.BuildHeaderValue();
hstsHeaderValue.Should().NotBeNull();
hstsHeaderValue.Should().Contain("max-age=31536000");
hstsHeaderValue.Should().Contain("includeSubDomains");
config.XFrameOptionsConfiguration.Should().NotBeNull();
var xFrameOptionHeaderValue = config.XFrameOptionsConfiguration.BuildHeaderValue();
xFrameOptionHeaderValue.Should().NotBeNull();
xFrameOptionHeaderValue.Should().Contain("DENY");
config.XFrameOptionsConfiguration.AllowFromDomain.Should().BeNull();
config.ContentSecurityPolicyConfiguration.BaseUri.Should().BeEmpty();
config.ContentSecurityPolicyConfiguration.DefaultSrc.Should().BeEmpty();
Expand Down

0 comments on commit 0762ae2

Please sign in to comment.