Skip to content

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

Open
danegsta wants to merge 19 commits intomainfrom
danegsta/trust
Open

Add logging if we detect the app host is running with an untrusted dev cert#13943
danegsta wants to merge 19 commits intomainfrom
danegsta/trust

Conversation

@danegsta
Copy link
Member

Description

It's possible, particularly after .NET SDK updates, to end up in a situation where there's a newer dev cert added to the CurrentUser/My cert store (which is the source of dev certs for TLS termination), but not to the CurrentUser/Root cert store which is where trusted certificates are pulled from. This can lead to a situation where services try to terminate HTTPS endpoints with an updated dev cert, but nothing actually trusts the new certificate. Diagnosing the issue is confusing and can require checking the logs for individual services.

This adds an explicit error level log if automatic dev cert trust is enabled and the latest certificate isn't in the trusted root store.

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?

Copilot AI review requested due to automatic review settings January 15, 2026 21:44
@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13943

Or

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

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

Copilot AI commented Jan 15, 2026

@danegsta I've opened a new pull request, #13946, to work on those changes. Once the pull request is ready, I'll request review from you.

@davidfowl
Copy link
Member

Logging isn't good enough, lets turn this into a notification.

@danegsta danegsta requested a review from mitchdenny as a code owner January 16, 2026 00:29
@danegsta
Copy link
Member Author

Logging isn't good enough, lets turn this into a notification.

Added both a notification and explicitly controlling the dev cert the dashboard uses.

@danegsta danegsta closed this Jan 16, 2026
@danegsta danegsta reopened this Jan 16, 2026
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Jan 16, 2026
@mitchdenny
Copy link
Member

/ba-g transient template failures.

Copy link
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

Looks good.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 157a72c:

Test Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording

📹 Recordings uploaded automatically from CI run #21379107285

logger.LogWarning("{Message}", message);

// Send notification to the dashboard
_ = interactionService.PromptNotificationAsync(
Copy link
Member

Choose a reason for hiding this comment

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

Why

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved where the check happens to DcpHost alongside the container runtime check.

Copy link
Contributor

Copilot AI commented Jan 24, 2026

@danegsta I've opened a new pull request, #14110, to work on those changes. Once the pull request is ready, I'll request review from you.

@davidfowl
Copy link
Member

@DamianEdwards can you try this out.

@DamianEdwards
Copy link
Member

DamianEdwards commented Feb 4, 2026

✅ PR #13943 Validation Report - VERIFIED

PR Information

  • Title: Add logging if we detect the app host is running with an untrusted dev cert
  • Head Commit: 157a72cc734739e9bd3613abb5193cb646f64545
  • Tested At: 2026-02-04

CLI Version Verification

  • Expected Commit: 157a72cc
  • Installed Version: 13.2.0-pr.13943.g157a72cc
  • Status: ✅ Verified

Test Results

Scenario Status Notes
1. Basic Aspire Project Run ✅ Passed 2 resources running correctly
2. Untrusted Cert Notification ✅ Passed Dashboard shows notification banner
3. Trusted Cert (Baseline) ✅ Passed No notification when cert is trusted

Evidence

Scenario 2 - Untrusted Certificate:

  • Console: ⚠ Developer certificates may not be fully trusted (trust exit code was: 4)
  • Log: [Warning] Aspire.Hosting.Dcp.DcpHost: The most recent ASP.NET Core Development Certificate isn't fully trusted. Run 'dotnet dev-certs https --trust'...
  • Dashboard: Notification banner visible - "Development certificate not fully trusted"
scenario2-untrusted-cert-notification

Scenario 3 - Trusted Certificate:

  • Console: No cert warnings
  • Log: No cert warnings
  • Dashboard: No notification banner
scenario3-trusted-cert-no-notification

Overall Result: ✅ PR VERIFIED

The PR correctly implements:

  1. Warning-level logging when the dev cert is untrusted
  2. Dashboard notification banner with actionable guidance (dotnet dev-certs https --trust)
  3. No false positives when the certificate is properly trusted

📋 Full session log: https://gist.github.com/DamianEdwards/9a40bff87fcf4cb6bd37321673feab10

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.

6 participants