Skip to content

[release/13.3] Add BrowserLogs tracked browser sessions#16637

Merged
joperezr merged 13 commits intorelease/13.3from
backport/pr-16565-to-release/13.3
May 1, 2026
Merged

[release/13.3] Add BrowserLogs tracked browser sessions#16637
joperezr merged 13 commits intorelease/13.3from
backport/pr-16565-to-release/13.3

Conversation

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

@aspire-repo-bot aspire-repo-bot Bot commented May 1, 2026

Backport of #16565 to release/13.3

/cc @davidfowl

Customer Impact

Customers targeting release/13.3 get BrowserLogs as an isolated prerelease hosting package and with tracked Chromium sessions using a private CDP pipe instead of an exposed browser debugging WebSocket/TCP endpoint. Without this backport, the release/13.3 BrowserLogs implementation would miss the package split and the pipe transport security mitigation, leaving the feature more likely to expose or reuse a browser debugging socket across AppHost runs. The feature enables dashboard-opened tracked browser sessions to capture browser console/runtime/network diagnostics, screenshots, and browser-session health reports.

Testing

Source PR validation included targeted BrowserLogs build/test coverage, Aspire.Hosting health report test coverage, TypeScript codegen capability tests, multi-language code generation snapshot tests, package creation for Aspire.Hosting.Browsers, and BrowserTelemetry playground E2E validation via aspire start --isolated, open-tracked-browser, and aspire logs web-browser-logs confirming CDP pipe sessions, network/console logs, health reports, and cleanup on stop. I also smoke-tested BrowserTelemetry on Windows from this branch after merge with tracked Edge launch, private CDP pipe session state, network log capture, healthy BrowserLogs state, and screenshot capture.

Risk

Medium. The change is opt-in and isolated to the experimental BrowserLogs surface and prerelease Aspire.Hosting.Browsers package, and it improves security posture by replacing exposed browser debugging WebSocket/TCP endpoints with private CDP pipes that are scoped to the tracked browser session. It still touches public API, package factoring, resource commands, platform-specific browser process launch/cleanup logic, CDP transport, dashboard-observable state, and localized resources.

Regression?

No - the source PR describes experimental feature factoring and security hardening for BrowserLogs rather than a regression fix.

davidfowl and others added 13 commits May 1, 2026 05:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Switch owned tracked-browser launches to a private CDP pipe, keep WebSocket adoption as an opt-in seam, and add session/persistent process lifetime configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BrowserLogs pipe-launched browsers are always session scoped because Chromium exits when the CDP pipe closes. Remove the public lifetime option and mark public BrowserLogs types experimental.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move platform-specific native launch logic into Windows and Unix partial classes while keeping the shared launcher entry points in the common file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the managed fork/exec launcher with posix_spawn file actions so Chromium still receives CDP pipe fds 3 and 4 without running managed code in a forked child.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the BrowserLogs capability from the Hosting assembly scanner snapshot now that BrowserLogs lives in Aspire.Hosting.Browsers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stop relying on InternalsVisibleTo for the Browsers package and its tests by source-sharing the BrowserLogs implementation into the test assembly and replacing Hosting-internal runtime dependencies with public-compatible behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a public CustomResourceSnapshot helper for publishing health reports without InternalsVisibleTo and use it to restore BrowserLogs session and last-error health report rows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add translator comments for BrowserLogs resource strings with format placeholders and regenerate XLF files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix null-forgiveness on screenshot Data property to throw
  InvalidOperationException instead of ArgumentNullException
- Guard _stopCts.Cancel() against ObjectDisposedException when
  MonitorAsync cleanup races with StopAsync
- Block '..' path traversal in SanitizePathSegment

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 1, 2026 05:29
@aspire-repo-bot aspire-repo-bot Bot review requested due to automatic review settings May 1, 2026 05:29
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16637

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16637"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🎬 CLI E2E Test Recordings — 66 recordings uploaded (commit f71e1c3)

View all recordings
Status Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25203674502

@joperezr joperezr merged commit 835723b into release/13.3 May 1, 2026
549 of 552 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.3 milestone May 1, 2026
@aspire-repo-bot
Copy link
Copy Markdown
Contributor Author

No documentation PR is required for this change.

The [integrations/devtools/browser-logs]((aspiredocs.azurewebsites.net/redacted) page on microsoft/aspire.dev branch release/13.3 was already updated in two recent commits (#775, #792) that document the Aspire.Hosting.Browsers package, WithBrowserLogs() API, tracked browser sessions, CDP pipe connectivity, BrowserUserDataMode, per-resource configuration, and all dashboard commands introduced by this feature. The existing documentation already covers the significant user-facing changes backported here.

Generated by PR Documentation Check for issue #16637 · ● 330.4K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants