Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into release-merge-find-and-connect #367

Merged
merged 51 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1c66f8c
feat(APIs): Remove IIS headers. Add security headers
Top-Cat Nov 28, 2024
9b9ff40
chore: Upgrade dfe-frontend package
stevesatdfe Nov 27, 2024
2dc8270
Revert launchsettings.json used for testing
Top-Cat Nov 28, 2024
c9c4469
Merge pull request #268 from DFE-Digital/feature/fhb-1025-update-dfe-…
stevesatdfe Nov 28, 2024
94e1fbe
Merge pull request #266 from DFE-Digital/FHB-1030
Top-Cat Nov 28, 2024
076259c
chore(terraform): Ensure all web APIs are HTTPS only and HTTP version…
stevesatdfe Nov 28, 2024
3d5b306
Merge pull request #272 from DFE-Digital/feature/fhb-1035-app-misconf…
stevesatdfe Nov 29, 2024
66a9561
feat: SQL Server auditing
stevesatdfe Dec 2, 2024
907a1ba
Merge pull request #277 from DFE-Digital/feature/fhb-1032-sql-server-…
stevesatdfe Dec 2, 2024
cb12570
Merge branch 'main' into merge-main-into-release-pen-test-changes
stevesatdfe Dec 3, 2024
bf86473
feat: Storage account misconfiguration
stevesatdfe Dec 2, 2024
4da3997
Merge pull request #286 from DFE-Digital/feature/1033-storage-account…
stevesatdfe Dec 3, 2024
5c2bf9e
Merge pull request #284 from DFE-Digital/merge-main-into-release-pen-…
stevesatdfe Dec 4, 2024
2e7129d
fix: Add alternative content security policy to APIs to allow Swagger…
stevesatdfe Dec 6, 2024
f2b895c
chore: Update swagger packages instead of header change
stevesatdfe Dec 6, 2024
54e89df
Merge pull request #292 from DFE-Digital/bugfix/fhb-1031-swagger-ui
stevesatdfe Dec 6, 2024
d9de0da
feat(terraform): Enable key vault purge protection and delete redunda…
stevesatdfe Dec 9, 2024
ef038de
Merge branch 'main' into merge-main-into-release-pen-test-changes
stevesatdfe Dec 10, 2024
a392a7d
Merge branch 'main' into merge-main-into-release-pen-test-changes
stevesatdfe Dec 10, 2024
eb27ba0
Merge branch 'main' into merge-main-into-release-pen-test-changes
stevesatdfe Dec 10, 2024
8db8abd
Merge pull request #305 from DFE-Digital/merge-main-into-release-pen-…
stevesatdfe Dec 10, 2024
17195f0
Merge pull request #308 from DFE-Digital/feature/fhb-1036-keyvault-mi…
stevesatdfe Dec 13, 2024
e46c8d8
feat(Shared-Razor): Use nonce for script tags instead of whitelist
Top-Cat Dec 13, 2024
490bc88
fix: Always enable Hsts and HttpsRedirection
Top-Cat Dec 13, 2024
a896119
Merge pull request #313 from DFE-Digital/FHB-1114
Top-Cat Dec 13, 2024
7519b0a
Merge pull request #312 from DFE-Digital/FHB-1115
Top-Cat Dec 13, 2024
d073597
Remote localhost Hsts macros
Top-Cat Dec 13, 2024
14659db
Merge pull request #315 from DFE-Digital/FHB-1115
Top-Cat Dec 16, 2024
3a7112b
Merge branch 'main' into merge-main-into-release-pen-test-changes
stevesatdfe Dec 17, 2024
f7c6c73
chore(terraform): Remove storage account for report stg api - lost in…
stevesatdfe Dec 17, 2024
2f2b74d
Merge pull request #320 from DFE-Digital/merge-main-into-release-pen-…
stevesatdfe Dec 17, 2024
fddb1e3
Remove app.UseHttpsRedirection()
stevesatdfe Dec 18, 2024
ef0f061
Add strict dynamic header for scripts
stevesatdfe Dec 18, 2024
963e766
chore: Add unsafe inline as well as struct dynamic for legacy browsers
stevesatdfe Dec 18, 2024
48dd9f2
Merge pull request #322 from DFE-Digital/bugfix/fhb-1114-fix-https-re…
stevesatdfe Dec 18, 2024
cc34131
Merge pull request #328 from DFE-Digital/main
stevesatdfe Jan 2, 2025
800b99b
Merge pull request #345 from DFE-Digital/main
stevesatdfe Jan 7, 2025
4c17d89
FHB - 1113: E2E Automated Tests: Adding Users in Manage as Dfe Admin …
tgohil-hippo Jan 10, 2025
3bc5c36
FHB-792 : E2E Test Pipeline (#338)
Zac-Digital Jan 13, 2025
791c8d2
FHB-1113: E2E Automated Tests: Adding Users in Manage as Dfe Admin (#…
tgohil-hippo Jan 13, 2025
267a205
FHB-1113: E2E Automated Tests: Adding Users in Manage as Dfe Admin (#…
tgohil-hippo Jan 13, 2025
b22feff
ci: use all cores of the runner
Zac-Digital Jan 14, 2025
6fbb0d4
Merge pull request #359 from DFE-Digital/ci/playwright-performance-op…
Zac-Digital Jan 14, 2025
f27fe81
chore: fix merge conflicts with main
Zac-Digital Jan 15, 2025
660595b
Merge pull request #363 from DFE-Digital/merge-main-release-pen-test-…
stevesatdfe Jan 15, 2025
9d60e5b
Merge branch 'main' of github.com:/DFE-Digital/fh-services into merge…
Zac-Digital Jan 15, 2025
20cbc75
Merge pull request #368 from DFE-Digital/merge-main-release-pen-test-…
Zac-Digital Jan 15, 2025
857634e
Merge pull request #369 from DFE-Digital/release-pen-test-changes
stevesatdfe Jan 15, 2025
f79d096
adding location seeding data
DamiLaleye1 Jan 20, 2025
3f6760a
additional formating
DamiLaleye1 Jan 20, 2025
3dc5af5
Merge pull request #374 from DFE-Digital/FHB-1183--E2E-Automated-Test…
DamiLaleye1 Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,13 @@ jobs:
app_name: ${{ matrix.app_name }}
test_project_name: ${{ matrix.test_project_name }}
project_type: service
secrets: inherit

run-ui-e2e-tests:
if: ${{ startsWith(inputs.environment, 'Test') || inputs.environment == 'Pre-production' }}
name: Run E2E Test Suite
needs: [ deploy-ui-services ]
uses: ./.github/workflows/run-e2e-tests.yml
with:
environment: ${{ inputs.environment }}
secrets: inherit
106 changes: 106 additions & 0 deletions .github/workflows/e2e-seed-database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Seed Database with E2E Test Data
run-name: Seed ${{ inputs.environment }} Database with E2E Test Data (${{ inputs.action }})

on:
workflow_dispatch:
inputs:
environment:
description: The environment target to seed test data in
default: 'Development'
type: choice
options:
- 'Development'
- 'Test'
- 'Test2'
- 'Pre-production'
action:
description: Whether to run the setup or teardown script
default: 'Teardown'
type: choice
options:
- 'Setup'
- 'Teardown'
workflow_call:
inputs:
environment:
required: true
type: string
action:
required: true
type: string

permissions:
id-token: write
contents: read

jobs:
run-seed-script:
name: Run ${{ inputs.action }} Script
runs-on: ubuntu-24.04
environment: ${{ inputs.environment }}
defaults:
run:
working-directory: "test/e2e-seed-data-framework"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: "lts/Jod" # 22 LTS

- name: Install NPM Packages
shell: bash
run: npm i

- name: Get Workflow Runner IP
id: runner-ip
uses: ./.github/actions/get-runner-ip-address

- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Add Azure Firewall Rule
uses: ./.github/actions/azure-firewall-ip
with:
ip_address: ${{ steps.runner-ip.outputs.ip_address }}
action: "Add"
az_resource_group: ${{ vars.AZURE_RESOURCE_PREFIX }}-familyhubs
az_sql_server_name: ${{ vars.AZURE_RESOURCE_PREFIX }}-as-fh-sql-server
az_firewall_rule_name: E2E-SEED-SCRIPT

- name: Create Environment Variables
shell: bash
run: |
cat <<'EOF' > .env
IDS_START_FROM=1000000
CONNECTION_STRING_SERVICEDIRECTORY='${{ secrets.PLAYWRIGHT_CONNECTION_STRING_SERVICE_DIRECTORY_DATABASE }}'
CONNECTION_STRING_REFERRAL='${{ secrets.PLAYWRIGHT_CONNECTION_STRING_REFERRAL_DATABASE }}'
CONNECTION_STRING_REPORT='${{ secrets.PLAYWRIGHT_CONNECTION_STRING_REPORT_DATABASE }}'
ENCRYPTION_KEY='${{ secrets.PLAYWRIGHT_REFERRAL_COLUMN_ENCRYPTION_KEY }}'
INITIALISATION_VECTOR='${{ secrets.PLAYWRIGHT_REFERRAL_COLUMN_INITIALISATION_VECTOR }}'
EXAMPLE_SEED=False
EOF

- name: Run ${{ inputs.action }}
shell: bash
run: |
SCRIPT=$(tr '[:upper:]' '[:lower:]' <<< "${{ inputs.action }}")
npm run $SCRIPT:dev

- name: Remove Azure Firewall Rule
if: always()
uses: ./.github/actions/azure-firewall-ip
with:
ip_address: ${{ steps.runner-ip.outputs.ip_address }}
action: "Remove"
az_resource_group: ${{ vars.AZURE_RESOURCE_PREFIX }}-familyhubs
az_sql_server_name: ${{ vars.AZURE_RESOURCE_PREFIX }}-as-fh-sql-server
az_firewall_rule_name: E2E-SEED-SCRIPT
132 changes: 132 additions & 0 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Run E2E Test Suite
run-name: Run E2E Test Suite on ${{ inputs.environment }}

on:
workflow_dispatch:
inputs:
environment:
description: The environment to run the E2E tests on
default: 'Development'
type: choice
options:
- 'Development'
- 'Test'
- 'Test2'
- 'Pre-production'
workflow_call:
inputs:
environment:
required: true
type: string

permissions:
id-token: write
contents: read

jobs:
pre-test-teardown:
name: Pre-Test Database Teardown
uses: ./.github/workflows/e2e-seed-database.yml
with:
environment: ${{ inputs.environment }}
action: 'Teardown'
secrets: inherit

pre-test-setup:
needs: [ pre-test-teardown ]
name: Pre-Test Database Setup
uses: ./.github/workflows/e2e-seed-database.yml
with:
environment: ${{ inputs.environment }}
action: 'Setup'
secrets: inherit

run-test-suite:
needs: [ pre-test-setup ]
name: ${{ matrix.job_name }}
strategy:
fail-fast: false
matrix:
suite: [ find-e2e-tests, manage-e2e-tests ]
include:
- suite: find-e2e-tests
job_name: E2E - Find UI
base_url: ${{ vars.PLAYWRIGHT_FIND_BASE_URL }}
- suite: manage-e2e-tests
job_name: E2E - Manage UI
base_url: ${{ vars.PLAYWRIGHT_MANAGE_BASE_URL }}
runs-on: ubuntu-24.04
environment: ${{ inputs.environment }}
defaults:
run:
working-directory: "test/${{ matrix.suite }}"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: "lts/Jod" # 22 LTS

- name: Install NPM Packages
shell: bash
run: npm i

- name: Install Playwright Dependencies
shell: bash
run: npx playwright install-deps

- name: Get Playwright Version
id: playwright-version
shell: bash
run: |
ARRAY=($(npx playwright --version))
VERSION=${ARRAY[1]}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Playwright Browser Cache
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-PlayWright-${{ steps.playwright-version.outputs.VERSION }}

- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: npx playwright install

- name: Create Environment Variables
shell: bash
run: |
cat <<'EOF' > .env
BASE_URL='${{ vars.PLAYWRIGHT_ENVIRONMENT_PREFIX }}${{ matrix.base_url }}'
USER_NAME='${{ secrets.PLAYWRIGHT_USER_NAME }}'
PASSWORD='${{ secrets.PLAYWRIGHT_PASSWORD }}'
DFE_ADMIN_USER='${{ secrets.PLAYWRIGHT_GOVLOGIN_DFE_ADMIN_USER }}'
GOV_LOGIN_PASSWORD='${{ secrets.PLAYWRIGHT_GOVLOGIN_PASSWORD }}'
EOF

- name: Run Playwright Test Suite
shell: bash
run: npx playwright test --workers `nproc`

- name: Upload Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.suite }}
path: "**/playwright-report/"

# Intentionally doesn't run after test failure to facilitate analysis
post-test-teardown:
needs: [ run-test-suite ]
name: Post-Test Database Teardown
uses: ./.github/workflows/e2e-seed-database.yml
with:
environment: ${{ inputs.environment }}
action: 'Teardown'
secrets: inherit
6 changes: 3 additions & 3 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="StackExchange.Redis" Version="2.8.12" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.1.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="7.1.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="7.1.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageVersion Include="System.Linq" Version="4.3.0" />
<PackageVersion Include="TestStack.BDDfy" Version="4.3.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public static void ConfigureWebApplication(this WebApplication webApplication)
webApplication.UseSwaggerUI();

webApplication.UseHttpsRedirection();
webApplication.UseHsts();

webApplication.MapControllers();

Expand Down
18 changes: 18 additions & 0 deletions src/service/idam-api/src/FamilyHubs.Idam.Api/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="Content-Security-Policy" value="default-src 'self';" />

<remove name="X-Powered-By" />
<remove name="x-aspnet-version"/>
</customHeaders>
</httpProtocol>
<security>
<requestFiltering removeServerHeader="true" />
</security>
</system.webServer>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
c.SwaggerEndpoint("/swagger/v1/swagger.json", "HSDA Mock API V1");
});

app.UseHttpsRedirection();
app.UseHsts();

app.UseRouting();

Expand Down
18 changes: 18 additions & 0 deletions src/service/mock-hsda-api/src/FamilyHubs.Mock-Hsda.Api/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="Content-Security-Policy" value="default-src 'self';" />

<remove name="X-Powered-By" />
<remove name="x-aspnet-version"/>
</customHeaders>
</httpProtocol>
<security>
<requestFiltering removeServerHeader="true" />
</security>
</system.webServer>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FamilyHubs.Notification.Core.Commands.CreateNotification;
using System.Net.Mime;
using FamilyHubs.Notification.Core.Commands.CreateNotification;
using FamilyHubs.Notification.Core.Queries.GetSentNotifications;
using FamilyHubs.Notification.Api.Contracts;
using MediatR;
Expand Down Expand Up @@ -26,14 +27,18 @@ public void RegisterMinimalNotifyEndPoints(WebApplication app)
var result = await _mediator.Send(request, cancellationToken);
return result;

}).WithMetadata(new SwaggerOperationAttribute("Get Notifications", "Get Paginated Notification List") { Tags = new[] { "Notifications" } });
})
.WithMetadata(new SwaggerOperationAttribute("Get Notifications", "Get Paginated Notification List") { Tags = new[] { "Notifications" } })
.Produces<PaginatedList<MessageDto>>(contentType: MediaTypeNames.Application.Json);

app.MapGet("api/notify/{id}", [Authorize] async (long id, CancellationToken cancellationToken, ISender _mediator) =>
{
GetNotificationByIdCommand request = new(id);
var result = await _mediator.Send(request, cancellationToken);
return result;

}).WithMetadata(new SwaggerOperationAttribute("Get Notification By Id", "Get Notification By Id") { Tags = new[] { "Notifications" } });
})
.WithMetadata(new SwaggerOperationAttribute("Get Notification By Id", "Get Notification By Id") { Tags = new[] { "Notifications" } })
.Produces<MessageDto>(contentType: MediaTypeNames.Application.Json);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public static void ConfigureWebApplication(this WebApplication webApplication)
webApplication.UseSwaggerUI();

webApplication.UseHttpsRedirection();
webApplication.UseHsts();

webApplication.MapControllers();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="Content-Security-Policy" value="default-src 'self';" />

<remove name="X-Powered-By" />
<remove name="x-aspnet-version"/>
</customHeaders>
</httpProtocol>
<security>
<requestFiltering removeServerHeader="true" />
</security>
</system.webServer>
</configuration>
Loading