Handle partial Linux certificate trust in CI - #17447
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17447Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17447" |
There was a problem hiding this comment.
Pull request overview
Updates the Aspire CLI certificate trust flow to treat partial trust on Linux CI (non-interactive) as a successful outcome (with a warning), while preserving failure semantics for interactive Linux and true trust failures. This aligns exit codes with the practical usability of partial OpenSSL trust for CLI/AppHost HTTPS diagnostics.
Changes:
- Adjusted
CertificateServiceto accept and return success forPartiallyFailedToTrustTheCertificateonly when non-interactive on Linux and a post-check confirmsTrustLevel.Partial. - Updated
certs trustcommand output to warn (instead of reporting full success) when continuing after partial trust. - Added/updated CLI unit tests and localized resources for the new warning message.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Commands/CertificatesCommandTests.cs | Adds an integration-style command test asserting partial-trust on non-interactive Linux returns exit code 0 and emits a warning. |
| tests/Aspire.Cli.Tests/Certificates/CertificateServiceTests.cs | Expands unit coverage for interactive vs non-interactive Linux partial-trust behavior and adjusts Linux simulation in tests. |
| src/Aspire.Cli/Certificates/CertificateService.cs | Implements “partial trust accepted” success path gated on non-interactive Linux + post-check confirmation. |
| src/Aspire.Cli/Commands/CertificatesTrustCommand.cs | Emits a warning message (not success) when the trust operation succeeded via partial trust acceptance. |
| src/Aspire.Cli/Resources/CertificatesCommandStrings.resx | Adds the new TrustPartialSuccess resource string. |
| src/Aspire.Cli/Resources/CertificatesCommandStrings.Designer.cs | Updates generated resource accessor for TrustPartialSuccess. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.cs.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.de.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.es.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.fr.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.it.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.ja.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.ko.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.pl.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.pt-BR.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.ru.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.tr.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.zh-Hans.xlf | Adds TrustPartialSuccess localization entry. |
| src/Aspire.Cli/Resources/xlf/CertificatesCommandStrings.zh-Hant.xlf | Adds TrustPartialSuccess localization entry. |
Copilot's findings
Files not reviewed (1)
- src/Aspire.Cli/Resources/CertificatesCommandStrings.Designer.cs: Language not supported
Comments suppressed due to low confidence (1)
tests/Aspire.Cli.Tests/Certificates/CertificateServiceTests.cs:127
- Same issue as above: the test asserts a hard-coded ".aspnet/dev-certs/trust" substring which is path-separator dependent. With
isLinux: () => truethe code still uses OS path separators for the dev-certs trust path, so this assertion can fail on Windows/macOS. UsePath.Combine(...)/separator normalization for the expected path portion, or skip the test outside Linux.
Assert.True(result.EnvironmentVariables.ContainsKey("SSL_CERT_DIR"));
Assert.Contains(".aspnet/dev-certs/trust", result.EnvironmentVariables["SSL_CERT_DIR"]);
}
- Files reviewed: 18/19 changed files
- Comments generated: 1
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Regarding review 4353075525: thanks for the overview. No code change was needed for this informational review summary; the actionable separator feedback was addressed in the follow-up commit. |
|
This same issue happens with |
|
❓ CLI E2E Tests unknown — 96 passed, 0 failed, 5 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26366088312 |
|
✅ No documentation update needed. A documentation update was drafted for |
|
David Pine (@IEvangelist) the doc bot is not working again |
Description
On non-interactive Linux CI runners,
aspire certs trust --non-interactivecan successfully install the development certificate for OpenSSL while still reportingPartiallyFailedToTrustTheCertificatebecause browser/NSS trust could not be completed. That partial state is useful for CLI diagnostics and AppHost HTTPS checks, but the command previously returned a hard failure.This change treats partial trust as success only for non-interactive Linux runs, and only after the post-trust check confirms the certificate is actually partially trusted. Interactive Linux runs and real trust failures still fail. The command now prints a warning explaining that CLI HTTPS diagnostics can continue while browser trust may remain incomplete.
User-facing usage
Partial Linux trust now exits successfully with guidance:
aspire doctorstill reports the partial trust state and guidance to setSSL_CERT_DIR; it does not hide that browser/user trust may be incomplete.Security considerations
This change affects certificate trust command success semantics. It does not skip the trust operation or convert full trust failures into success. The success path is limited to non-interactive Linux and requires the post-trust certificate check to report
TrustLevel.Partial, preserving failure behavior for untrusted certificates and interactive runs.Validation:
dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.CertificateServiceTests" --filter-class "*.CertificatesCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"aspire certs trust --non-interactivereturnedEXIT:0with the new partial-trust warning.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?