From 860173c5a28061920b5073090b7e676de5bf85bc Mon Sep 17 00:00:00 2001 From: Samat Imamov <31497046+Samat-Imamov@users.noreply.github.com> Date: Tue, 16 Sep 2025 08:31:21 -0700 Subject: [PATCH 1/3] Added support for client certificates (#1063) Issue: https://github.com/browserbase/stagehand/issues/1030 # why Allowing authentication using provided client certificates during local runs. # what changed Additional configuration value 'clientCertificates' that's being passed during Playwright context creation. # test plan This is additional support for already existing Playwright feature so Playwright team's internal test for this feature should be enough. But to test locally, provide client certificate config according to this API - https://playwright.dev/docs/api/class-browser#browser-new-context-option-client-certificates - and authenticate to whichever service that certificate belongs to. --- lib/index.ts | 1 + types/stagehand.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/index.ts b/lib/index.ts index 04cd4a5bf..300e3178d 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -309,6 +309,7 @@ async function getBrowser( handleSIGINT: localBrowserLaunchOptions?.handleSIGINT ?? true, handleSIGTERM: localBrowserLaunchOptions?.handleSIGTERM ?? true, ignoreDefaultArgs: localBrowserLaunchOptions?.ignoreDefaultArgs, + clientCertificates: localBrowserLaunchOptions?.clientCertificates, }); if (localBrowserLaunchOptions?.cookies) { diff --git a/types/stagehand.ts b/types/stagehand.ts index 50f2ac2a5..33eb98475 100644 --- a/types/stagehand.ts +++ b/types/stagehand.ts @@ -174,6 +174,16 @@ export interface ObserveResult { export interface LocalBrowserLaunchOptions { args?: string[]; chromiumSandbox?: boolean; + clientCertificates?: Array<{ + origin: string; + certPath?: string; + cert?: Buffer; + keyPath?: string; + key?: Buffer; + pfxPath?: string; + pfx?: Buffer; + passphrase?: string; + }>; devtools?: boolean; env?: Record; executablePath?: string; From 694a4ec885886ffc7e09586a276c3ec7a72a558e Mon Sep 17 00:00:00 2001 From: miguel Date: Tue, 16 Sep 2025 08:34:32 -0700 Subject: [PATCH 2/3] changeset --- .changeset/blue-islands-unite.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/blue-islands-unite.md diff --git a/.changeset/blue-islands-unite.md b/.changeset/blue-islands-unite.md new file mode 100644 index 000000000..5c63f7509 --- /dev/null +++ b/.changeset/blue-islands-unite.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": major +--- + +Add support for client certificates on local envs From 44a2760694a98ed88137fa35be308324f130244f Mon Sep 17 00:00:00 2001 From: miguel Date: Tue, 16 Sep 2025 08:34:48 -0700 Subject: [PATCH 3/3] prettier --- types/stagehand.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/stagehand.ts b/types/stagehand.ts index 33eb98475..d5fe4743a 100644 --- a/types/stagehand.ts +++ b/types/stagehand.ts @@ -175,14 +175,14 @@ export interface LocalBrowserLaunchOptions { args?: string[]; chromiumSandbox?: boolean; clientCertificates?: Array<{ - origin: string; - certPath?: string; - cert?: Buffer; - keyPath?: string; - key?: Buffer; - pfxPath?: string; - pfx?: Buffer; - passphrase?: string; + origin: string; + certPath?: string; + cert?: Buffer; + keyPath?: string; + key?: Buffer; + pfxPath?: string; + pfx?: Buffer; + passphrase?: string; }>; devtools?: boolean; env?: Record;