Skip to content

[release/13.2] Use ASP.NET Core dev cert for DCP to avoid issues with ephemeral cert trust - #15722

Merged
Jose Perez Rodriguez (joperezr) merged 2 commits into
release/13.2from
danegsta/backport15718
Apr 1, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 2 commits into
release/13.2from
danegsta/backport15718

Conversation

@danegsta

@danegsta David Negstad (danegsta) commented Mar 31, 2026 •

Copy link
Copy Markdown
Member

Backport #15718 to release/13.2

This depends on #15713

Customer Impact

Allow users to opt-in to using the ASP.NET Dev Cert to secure the DCP connection on Windows by setting ASPIRE_DCP_USE_DEVELOPER_CERTIFICATE=true.

Testing

Manual validation of using the ASP.NET dev cert to secure the connection.

Risk

Low - default connection behavior remains the existing ephemeral certificate flow

Regression?

No

… trust (#15718)

* Use ASP.NET Core dev cert for DCP to avoid issues with ephemeral cert trust

* Make using the dev cert for DCP configurable and opt-in

* Update for DCP's new thumbprint based method of referencing a certificate from the cert store

* Remove obsolete DcpHost TLS certificate tests

The PrepareDcpTlsCertificateAsync implementation changed from writing
PEM files to disk to storing a certificate thumbprint in memory (passed
as --tls-cert-thumbprint to the DCP process). The 4 tests in
DcpHostTests.cs were asserting PEM file existence which no longer
applies. The method's logic is simple sequential early-returns with no
complex branching, so these tests are not worth rewriting with
log-based assertions.

Co-authored-by: Copilot <[email protected]>

* Add support for testing DcpHost.CreateDcpProcessSpec

* Update environment variable name

---------

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings March 31, 2026 01:21
@github-actions

github-actions Bot commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

🚀 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 -- 15722

Or

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports support for opting into using the trusted ASP.NET Core developer certificate to secure the DCP TLS connection on Windows (via ASPIRE_DCP_USE_DEVELOPER_CERTIFICATE), while keeping the existing ephemeral certificate behavior as the default.

Changes:

  • Add an opt-in flow in DcpHost to prepare and pass a dev-cert thumbprint to DCP (--tls-cert-thumbprint) on Windows.
  • Centralize macOS dev-cert key material caching/export logic into DeveloperCertificateService and reuse it from DcpExecutor.
  • Add unit tests covering DCP process spec argument composition.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Aspire.Hosting.Tests/Dcp/DcpHostNotificationTests.cs Adds process spec argument tests and updates ctor usage after DcpHost signature change.
src/Shared/KnownConfigNames.cs Adds ASPIRE_DCP_USE_DEVELOPER_CERTIFICATE config name constant.
src/Aspire.Hosting/DeveloperCertificateService.cs Adds reusable key material export + macOS caching (PEM/PFX).
src/Aspire.Hosting/Dcp/DcpHost.cs Implements opt-in thumbprint preparation and appends DCP CLI argument.
src/Aspire.Hosting/Dcp/DcpExecutor.cs Switches to shared key-material export implementation and removes duplicated caching logic.

@joperezr

Copy link
Copy Markdown
Member

Waiting on David Negstad (@danegsta) to confirm if we are ready to take this. We had discussed this offline and it is approved for servicing, but we may need some extra changes in release/13.2 which is why I'll await confiramtion.

@joperezr Jose Perez Rodriguez (joperezr) added the Servicing-approved Approved for servicing release label Apr 1, 2026
@joperezr

Copy link
Copy Markdown
Member

Oh, I see the other PR is ready. David Negstad (@danegsta) let me know when we are ready to merge both

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 53 recordings uploaded (commit bfca5b5)

View recordings
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
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
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ 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
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ 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
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23867758796

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@joperezr
Jose Perez Rodriguez (joperezr) merged commit b4e9e32 into release/13.2 Apr 1, 2026
505 of 508 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants