From ccba8d65c8803eb96113fd9dfc6b1de9048dce38 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 07:40:22 +0000 Subject: [PATCH 1/3] Initial plan From b5c1ad23954692058386207edb74b31e5045d7be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 07:42:02 +0000 Subject: [PATCH 2/3] feat: add custom HTTP header support to Playwright tests for firewall bypass Co-authored-by: simonknittel <8451099+simonknittel@users.noreply.github.com> --- .github/workflows/playwright-tests.yml | 2 ++ pnpm-monorepo/apps/playwright/.env.example | 2 ++ pnpm-monorepo/apps/playwright/playwright.config.ts | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml index 19f515351..e3ae1404f 100644 --- a/.github/workflows/playwright-tests.yml +++ b/.github/workflows/playwright-tests.yml @@ -44,6 +44,8 @@ jobs: run: pnpm --filter @sam-monorepo/playwright test env: BASE_URL: ${{ vars.BASE_URL }} + PLAYWRIGHT_CUSTOM_HEADER_NAME: ${{ vars.PLAYWRIGHT_CUSTOM_HEADER_NAME }} + PLAYWRIGHT_CUSTOM_HEADER_VALUE: ${{ secrets.PLAYWRIGHT_CUSTOM_HEADER_VALUE }} - name: Upload test report uses: actions/upload-artifact@v4.6.2 diff --git a/pnpm-monorepo/apps/playwright/.env.example b/pnpm-monorepo/apps/playwright/.env.example index 717a4c762..4ea66a323 100644 --- a/pnpm-monorepo/apps/playwright/.env.example +++ b/pnpm-monorepo/apps/playwright/.env.example @@ -1 +1,3 @@ BASE_URL= +PLAYWRIGHT_CUSTOM_HEADER_NAME= +PLAYWRIGHT_CUSTOM_HEADER_VALUE= diff --git a/pnpm-monorepo/apps/playwright/playwright.config.ts b/pnpm-monorepo/apps/playwright/playwright.config.ts index 20cb39f7f..0fe7c60c5 100644 --- a/pnpm-monorepo/apps/playwright/playwright.config.ts +++ b/pnpm-monorepo/apps/playwright/playwright.config.ts @@ -1,6 +1,12 @@ import { defineConfig } from "@playwright/test"; import "dotenv/config"; +// Build custom HTTP headers object if both name and value are provided +const extraHTTPHeaders: Record = {}; +if (process.env.PLAYWRIGHT_CUSTOM_HEADER_NAME && process.env.PLAYWRIGHT_CUSTOM_HEADER_VALUE) { + extraHTTPHeaders[process.env.PLAYWRIGHT_CUSTOM_HEADER_NAME] = process.env.PLAYWRIGHT_CUSTOM_HEADER_VALUE; +} + export default defineConfig({ testDir: "./tests", fullyParallel: true, @@ -11,5 +17,6 @@ export default defineConfig({ use: { baseURL: process.env.BASE_URL, trace: "on-first-retry", + ...(Object.keys(extraHTTPHeaders).length > 0 && { extraHTTPHeaders }), }, }); From 2fde3fb52e603df5b30e4669026b4d06cccf5a33 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 07:42:42 +0000 Subject: [PATCH 3/3] refactor: add validation for custom HTTP header name Co-authored-by: simonknittel <8451099+simonknittel@users.noreply.github.com> --- pnpm-monorepo/apps/playwright/playwright.config.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pnpm-monorepo/apps/playwright/playwright.config.ts b/pnpm-monorepo/apps/playwright/playwright.config.ts index 0fe7c60c5..df64f1e77 100644 --- a/pnpm-monorepo/apps/playwright/playwright.config.ts +++ b/pnpm-monorepo/apps/playwright/playwright.config.ts @@ -3,8 +3,15 @@ import "dotenv/config"; // Build custom HTTP headers object if both name and value are provided const extraHTTPHeaders: Record = {}; -if (process.env.PLAYWRIGHT_CUSTOM_HEADER_NAME && process.env.PLAYWRIGHT_CUSTOM_HEADER_VALUE) { - extraHTTPHeaders[process.env.PLAYWRIGHT_CUSTOM_HEADER_NAME] = process.env.PLAYWRIGHT_CUSTOM_HEADER_VALUE; +const headerName = process.env.PLAYWRIGHT_CUSTOM_HEADER_NAME; +const headerValue = process.env.PLAYWRIGHT_CUSTOM_HEADER_VALUE; + +if (headerName && headerValue) { + // Basic validation: HTTP header names should be alphanumeric with hyphens/underscores + if (!/^[a-zA-Z0-9_-]+$/.test(headerName)) { + throw new Error(`Invalid HTTP header name: ${headerName}. Header names must contain only alphanumeric characters, hyphens, and underscores.`); + } + extraHTTPHeaders[headerName] = headerValue; } export default defineConfig({