Skip to content

Add logging if we detect the app host is running with an untrusted dev cert#15042

Merged
danegsta merged 2 commits intodanegsta/trustLogfrom
copilot/sub-pr-14666
Mar 7, 2026
Merged

Add logging if we detect the app host is running with an untrusted dev cert#15042
danegsta merged 2 commits intodanegsta/trustLogfrom
copilot/sub-pr-14666

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

Description

When automatic dev cert trust is enabled but the newest dev cert isn't in the trusted root store, Aspire now emits explicit log warnings and dashboard notifications to surface the issue. This replaces confusing per-service TLS errors with a clear actionable message pointing to https://aka.ms/aspire/devcerts.

Changes:

  • DcpHost.cs: During startup, checks for HTTPS/TLS usage before probing cert trust state. Emits LogWarning and sends a dashboard notification (when available) if no trusted certs exist or the latest cert is untrusted. Log messages and dashboard messages now reference https://aka.ms/aspire/devcerts instead of dotnet dev-certs commands.
  • DeveloperCertificateService: Cross-platform trust detection via X509Chain building. Exposes Certificates (trusted only) and LatestCertificateIsUntrusted to distinguish between "no trusted cert" and "newer untrusted cert present" scenarios.
  • DashboardEventHandlers: Configures the dashboard Kestrel instance and the app host gRPC service with a certificate callback that uses a verified dev cert rather than the default Kestrel cert resolution.
  • InteractionStrings.resx + all .xlf files: Messages updated to drop dotnet dev-certs https --trust command references in favor of See https://aka.ms/aspire/devcerts for more information.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ts link

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logging for untrusted dev certificate detection Add logging if we detect the app host is running with an untrusted dev cert Mar 7, 2026
@danegsta danegsta marked this pull request as ready for review March 7, 2026 21:06
@danegsta danegsta merged commit 12754bc into danegsta/trustLog Mar 7, 2026
3 of 4 checks passed
@danegsta danegsta deleted the copilot/sub-pr-14666 branch March 7, 2026 21:07
danegsta added a commit that referenced this pull request Mar 9, 2026
…v cert (#14666)

* Add logging if we detect the app host is running with an untrusted dev cert

* Allow overriding the dev cert used by the dashboard

* Also notify the dashboard if the certificate isn't trusted

* Update src/Aspire.Hosting/DeveloperCertificateService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Move forward unlocking the macos keychain and trust the cert

* Update trust check to handle MacOS

* Add link to dev-certs code

* Cleanup some of the exceptions

* Trusting on Mac isn't going to be an option; switch to a warning in logs

* Use resource strings, move check and logging to DcpHost setup

* Update how HTTPS check is determined

* Use the file system service to get a temp folder

* Refactor DeveloperCertificateService to use ProcessSpec and ProcessUtil APIs with async/await (#14110)

* Update test service mocks

* Guard against the interaction service not being available

* Fix merge issue in DashboardEventHandlers

* Fix developer cert service timeout on Mac CI

* Only skip interaction service prompt if service not available

* Add additional test

* Fix failing test

* Disable dev cert https in mac ci tests

* Revert unrequired macos timeout change

* Add comments explaining the dashboard certificate config

* Only warn if there's an HTTPS/TLS endpoint

* Cleanup how we determine certificate trust to a cross-platform approach

* Expose interface property such that it can be used in tests

* Add chain build that got removed

* Check if cert is in root store on Windows

* Fix check that wasn't properly detecting the lack of trusted certificates

* Update src/Aspire.Hosting/Dcp/DcpHost.cs

Co-authored-by: Damian Edwards <damian@damianedwards.com>

* Add logging if we detect the app host is running with an untrusted dev cert (#15042)

* Initial plan

* Replace dotnet dev-certs command references with aka.ms/aspire/devcerts link

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

* Fix failing test after log message updated to reference aka.ms/aspire/devcerts (#15043)

* Initial plan

* Fix failing test that was checking for outdated string content after log message update

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

* Replace "ASP.NET Core Development Certificate" with "development certificate" in user-facing strings (#15048)

* Initial plan

* Replace "ASP.NET Core Development Certificate" with "development certificate" in strings

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Damian Edwards <damian@damianedwards.com>
Copilot AI added a commit that referenced this pull request Mar 10, 2026
…v cert (#14666)

* Add logging if we detect the app host is running with an untrusted dev cert

* Allow overriding the dev cert used by the dashboard

* Also notify the dashboard if the certificate isn't trusted

* Update src/Aspire.Hosting/DeveloperCertificateService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Move forward unlocking the macos keychain and trust the cert

* Update trust check to handle MacOS

* Add link to dev-certs code

* Cleanup some of the exceptions

* Trusting on Mac isn't going to be an option; switch to a warning in logs

* Use resource strings, move check and logging to DcpHost setup

* Update how HTTPS check is determined

* Use the file system service to get a temp folder

* Refactor DeveloperCertificateService to use ProcessSpec and ProcessUtil APIs with async/await (#14110)

* Update test service mocks

* Guard against the interaction service not being available

* Fix merge issue in DashboardEventHandlers

* Fix developer cert service timeout on Mac CI

* Only skip interaction service prompt if service not available

* Add additional test

* Fix failing test

* Disable dev cert https in mac ci tests

* Revert unrequired macos timeout change

* Add comments explaining the dashboard certificate config

* Only warn if there's an HTTPS/TLS endpoint

* Cleanup how we determine certificate trust to a cross-platform approach

* Expose interface property such that it can be used in tests

* Add chain build that got removed

* Check if cert is in root store on Windows

* Fix check that wasn't properly detecting the lack of trusted certificates

* Update src/Aspire.Hosting/Dcp/DcpHost.cs

Co-authored-by: Damian Edwards <damian@damianedwards.com>

* Add logging if we detect the app host is running with an untrusted dev cert (#15042)

* Initial plan

* Replace dotnet dev-certs command references with aka.ms/aspire/devcerts link

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

* Fix failing test after log message updated to reference aka.ms/aspire/devcerts (#15043)

* Initial plan

* Fix failing test that was checking for outdated string content after log message update

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

* Replace "ASP.NET Core Development Certificate" with "development certificate" in user-facing strings (#15048)

* Initial plan

* Replace "ASP.NET Core Development Certificate" with "development certificate" in strings

Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Damian Edwards <damian@damianedwards.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants