Skip to content

Commit

Permalink
Simplification of project layout; Updated all relevant GitHub actions…
Browse files Browse the repository at this point in the history
… files (#133)

* Simplification of project layout; Updated all relevant GitHub actions files

* Patch version bump
  • Loading branch information
GaProgMan authored Dec 2, 2024
1 parent 406fcb7 commit 3442640
Show file tree
Hide file tree
Showing 36 changed files with 101 additions and 89 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '.github/**'
- '*.md'
- 'docs/**'
paths:
- 'src/**'
- 'tests/**'
- 'example/**'
- '.github/workflows/**'

jobs:

Expand Down Expand Up @@ -76,7 +77,6 @@ jobs:

- name: Run all tests
run: dotnet test OwaspHeaders.Core.sln --verbosity minimal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage
working-directory: ${{env.working-directory}}

- name: Code Coverage Summary Report
uses: irongut/[email protected]
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '*.md'
- 'docs/**'
paths:
- 'src/**'
- 'tests/**'
- 'example/**'
- '.github/workflows/**'

jobs:

Expand Down Expand Up @@ -50,7 +51,7 @@ jobs:
dotnet-version: '9.0.x'

- name: Run all tests
run: dotnet test OwaspHeaders.Core.Tests/OwaspHeaders.Core.Tests.csproj --verbosity minimal
run: dotnet test OwaspHeaders.Core.sln --verbosity minimal


package:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ on:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '*.md'
- 'docs/**'
paths:
- 'src/**'
- 'tests/**'
- 'example/**'

permissions: read-all

Expand Down
31 changes: 21 additions & 10 deletions OwaspHeaders.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwaspHeaders.Core", "src\OwaspHeaders.Core.csproj", "{02A107D0-EDC6-499A-BF33-9F1F3C588065}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwaspHeaders.Core.Tests", "OwaspHeaders.Core.Tests\OwaspHeaders.Core.Tests.csproj", "{E5626AB0-703E-46F8-92DC-B525D4CEC4E3}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0595EB31-3FE3-4CE1-B354-60EB228A6101}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwaspHeaders.Core.Example", "OwaspHeaders.Core.Example\OwaspHeaders.Core.Example.csproj", "{8D3C719A-74EE-40D9-B78A-DCD189E88D5E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{14172BC1-8EB6-4FBC-8D42-729A804BCB84}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwaspHeaders.Core.Tests", "tests\OwaspHeaders.Core.Tests\OwaspHeaders.Core.Tests.csproj", "{05F6E4B3-759E-4663-90CE-838471A097F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{582E653A-7CF6-4F4C-BBB3-F1C5CF4F0D50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwaspHeaders.Core.Example", "example\OwaspHeaders.Core.Example\OwaspHeaders.Core.Example.csproj", "{BEB61669-411E-4F6C-915F-FD0889B648F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,13 +27,18 @@ Global
{02A107D0-EDC6-499A-BF33-9F1F3C588065}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02A107D0-EDC6-499A-BF33-9F1F3C588065}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02A107D0-EDC6-499A-BF33-9F1F3C588065}.Release|Any CPU.Build.0 = Release|Any CPU
{E5626AB0-703E-46F8-92DC-B525D4CEC4E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5626AB0-703E-46F8-92DC-B525D4CEC4E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5626AB0-703E-46F8-92DC-B525D4CEC4E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5626AB0-703E-46F8-92DC-B525D4CEC4E3}.Release|Any CPU.Build.0 = Release|Any CPU
{8D3C719A-74EE-40D9-B78A-DCD189E88D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D3C719A-74EE-40D9-B78A-DCD189E88D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D3C719A-74EE-40D9-B78A-DCD189E88D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D3C719A-74EE-40D9-B78A-DCD189E88D5E}.Release|Any CPU.Build.0 = Release|Any CPU
{05F6E4B3-759E-4663-90CE-838471A097F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05F6E4B3-759E-4663-90CE-838471A097F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05F6E4B3-759E-4663-90CE-838471A097F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05F6E4B3-759E-4663-90CE-838471A097F6}.Release|Any CPU.Build.0 = Release|Any CPU
{BEB61669-411E-4F6C-915F-FD0889B648F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEB61669-411E-4F6C-915F-FD0889B648F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEB61669-411E-4F6C-915F-FD0889B648F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEB61669-411E-4F6C-915F-FD0889B648F3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{02A107D0-EDC6-499A-BF33-9F1F3C588065} = {0595EB31-3FE3-4CE1-B354-60EB228A6101}
{05F6E4B3-759E-4663-90CE-838471A097F6} = {14172BC1-8EB6-4FBC-8D42-729A804BCB84}
{BEB61669-411E-4F6C-915F-FD0889B648F3} = {582E653A-7CF6-4F4C-BBB3-F1C5CF4F0D50}
EndGlobalSection
EndGlobal
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\OwaspHeaders.Core.csproj" />
<ProjectReference Include="..\..\src\OwaspHeaders.Core.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/OwaspHeaders.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- NuGet metadata -->
<PackageId>OwaspHeaders.Core</PackageId>
<Version>9.2.1</Version>
<Version>9.2.2</Version>
<Authors>Jamie Taylor</Authors>
<Company>RJJ Software Ltd</Company>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
namespace OwaspHeaders.Core.Tests.CustomHeaders
{
public class CrossOriginOptionsTests : SecureHeadersTests
{
[Fact]
public async Task When_UseCrossOriginResourcePolicyCalled_Header_Is_Present()
{
// arrange
var headerPresentConfig =
SecureHeadersMiddlewareBuilder.CreateBuilder()
.UseCrossOriginResourcePolicy().Build();
var secureHeadersMiddleware = new SecureHeadersMiddleware(_onNext, headerPresentConfig);

// act
await secureHeadersMiddleware.InvokeAsync(_context);

// assert
Assert.True(headerPresentConfig.UseCrossOriginResourcePolicy);
Assert.True(_context.Response.Headers.ContainsKey(Constants.CrossOriginResourcePolicyHeaderName));
Assert.Equal(CrossOriginResourcePolicy.SameOriginValue,
_context.Response.Headers[Constants.CrossOriginResourcePolicyHeaderName]);
}

[Fact]
public async Task When_UseCrossOriginResourcePolicyNotCalled_Header_Not_Present()
{
// arrange
var headerNotPresentConfig = SecureHeadersMiddlewareBuilder.CreateBuilder()
.Build();
var secureHeadersMiddleware = new SecureHeadersMiddleware(_onNext, headerNotPresentConfig);

// act
await secureHeadersMiddleware.InvokeAsync(_context);

// assert
Assert.False(headerNotPresentConfig.UseCrossOriginResourcePolicy);
Assert.False(_context.Response.Headers.ContainsKey(Constants.CrossOriginResourcePolicyHeaderName));
}
}
}
namespace OwaspHeaders.Core.Tests.CustomHeaders
{
public class CrossOriginOptionsTests : SecureHeadersTests
{
[Fact]
public async Task When_UseCrossOriginResourcePolicyCalled_Header_Is_Present()
{
// arrange
var headerPresentConfig =
SecureHeadersMiddlewareBuilder.CreateBuilder()
.UseCrossOriginResourcePolicy().Build();
var secureHeadersMiddleware = new SecureHeadersMiddleware(_onNext, headerPresentConfig);

// act
await secureHeadersMiddleware.InvokeAsync(_context);

// assert
Assert.True(headerPresentConfig.UseCrossOriginResourcePolicy);
Assert.True(_context.Response.Headers.ContainsKey(Constants.CrossOriginResourcePolicyHeaderName));
Assert.Equal(CrossOriginResourcePolicy.SameOriginValue,
_context.Response.Headers[Constants.CrossOriginResourcePolicyHeaderName]);
}

[Fact]
public async Task When_UseCrossOriginResourcePolicyNotCalled_Header_Not_Present()
{
// arrange
var headerNotPresentConfig = SecureHeadersMiddlewareBuilder.CreateBuilder()
.Build();
var secureHeadersMiddleware = new SecureHeadersMiddleware(_onNext, headerNotPresentConfig);

// act
await secureHeadersMiddleware.InvokeAsync(_context);

// assert
Assert.False(headerNotPresentConfig.UseCrossOriginResourcePolicy);
Assert.False(_context.Response.Headers.ContainsKey(Constants.CrossOriginResourcePolicyHeaderName));
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-*" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<ProjectReference Include="..\src\OwaspHeaders.Core.csproj" />
<ProjectReference Include="..\..\src\OwaspHeaders.Core.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests.csproj", "{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests.csproj", "{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E8832DB-616D-4BC3-A193-6D1A0C1176E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

0 comments on commit 3442640

Please sign in to comment.