Skip to content

Include concatenated certificate+key PEM file in TLS contexts - #18216

Merged
David Negstad (danegsta) merged 7 commits into
microsoft:mainfrom
aradalvand:certificate-with-key-pem
Jun 19, 2026
Merged

David Negstad (danegsta) merged 7 commits into
microsoft:mainfrom
aradalvand:certificate-with-key-pem

Conversation

@aradalvand

@aradalvand Arad Alvand (aradalvand) commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #18215

Added a third "certificate-with-key" PEM file and its path reference to all relevant classes, namely HttpsCertificateConfigurationCallbackAnnotationContext, ContainerFileSystemCallbackHttpsCertificateContext, and HttpsCertificateExecutionConfigurationContext. Also implemented the necessary logic for creating the file inside ContainerCreator and ExecutableCreator.

I included these properties in the ExecutionConfigurationGathererTests. And I also did manually test out the whole functionality in the context of my other PR (#18196), and it works. But I couldn't find any automated tests against ContainerCreator or ExecutableCreator to write functional tests for it. So, I'm assuming there are none at the moment.

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

@github-actions

github-actions Bot commented Jun 15, 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 -- 18216

Or

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

@aradalvand Arad Alvand (aradalvand) changed the title introduce concatenated certificate+key PEM file for TLS Include concatenated certificate+key PEM file in TLS contexts Jun 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@aradalvand

Copy link
Copy Markdown
Contributor Author

Any guidance on how the cross-language tests are supposed to be fixed?

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@aradalvand

Arad Alvand (aradalvand) commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor Author

David Negstad (@danegsta) I did update the code generation snapshots which fixed all but one test, apparently. The "TypeScript API compatibility" one is still failing, can you please let me know what should be done about that one in particular? I was under the impression that this is due to the tests in tests/Aspire.Hosting.CodeGeneration.TypeScript.JsTests somehow failing but then I did run npm run test on that project and all the tests indeed passed.

Apparently it is the tools/TypeScriptApiCompat program being executed. But I'm not positive what that does.

image

@davidfowl

Copy link
Copy Markdown
Collaborator

cc Sébastien Ros (@sebastienros)

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@danegsta

Copy link
Copy Markdown
Member

PR Testing Report

PR Information

Artifact Version Verification

  • Expected Commit: e8c5949
  • Installed Version: 13.5.0-pr.18216.ge8c5949a
  • Status: ✅ Verified (13.5.0-pr.18216.ge8c5949a contains short SHA e8c5949a)

Changes Analyzed

Files Changed

  • src/Aspire.Hosting/ApplicationModel/ContainerFileSystemCallbackAnnotation.cs - Modified
  • src/Aspire.Hosting/ApplicationModel/HttpsCertificateConfigurationCallbackAnnotaion.cs - Modified
  • src/Aspire.Hosting/ApplicationModel/HttpsCertificateExecutionConfigurationGatherer.cs - Modified
  • src/Aspire.Hosting/Ats/ExecutionConfigurationExports.cs - Modified
  • src/Aspire.Hosting/Dcp/ContainerCreator.cs - Modified
  • src/Aspire.Hosting/Dcp/ExecutableCreator.cs - Modified
  • src/Aspire.Hosting/api/Aspire.Hosting.tscompat.suppression.txt - Modified
  • tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBExtensionsTests.cs - Modified
  • tests/Aspire.Hosting.CodeGeneration.*.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.* - Modified
  • tests/Aspire.Hosting.JavaScript.Tests/AddViteAppTests.cs - Modified
  • tests/Aspire.Hosting.Tests/ExecutionConfigurationGathererTests.cs - Modified

Change Categories

  • CLI changes detected
  • Hosting changes detected
  • Dashboard changes
  • Template changes
  • Client/Component changes
  • CI infrastructure changes
  • VS Code extension changes
  • Test changes detected

Test Scenarios Executed

Scenario 1: Dogfood artifact verification

Objective: Verify the tested CLI/packages were built from the PR head commit.
Coverage Type: Artifact/version validation
Status: ✅ Passed

Steps:

  1. Installed PR Include concatenated certificate+key PEM file in TLS contexts #18216 dogfood artifacts into an isolated temp directory with --install-path, --skip-path, and --skip-extension.
  2. Ran the installed CLI binary directly with --version.
  3. Compared the reported version to PR head commit e8c5949adeecc2bef448c8547b6664872df6046d.

Evidence:

  • Install log: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/install.log
  • Version output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/version.txt

Observations:

  • Installed version was 13.5.0-pr.18216.ge8c5949a, matching PR head short SHA e8c5949a.

Scenario 2: Executable combined PEM runtime

Objective: Verify an executable resource can consume HttpsCertificateConfigurationCallbackAnnotationContext.CertificateWithKeyPath without also referencing KeyPath, and that the generated file contains both private key and certificate PEM blocks.
Coverage Type: Runtime boundary/regression
Status: ✅ Passed

Steps:

  1. Created a fresh aspire-empty C# AppHost from the PR package hive.
  2. Replaced the AppHost with a self-signed certificate setup and an executable resource.
  3. Configured the executable with WithHttpsCertificate(certificateWithPrivateKey) and WithHttpsCertificateConfiguration(ctx => ctx.EnvironmentVariables["ASPIRE_CERT_WITH_KEY"] = ctx.CertificateWithKeyPath).
  4. Started the AppHost using the PR CLI.
  5. The executable checked that ASPIRE_CERT_WITH_KEY was set, the file existed, and the file contained both BEGIN ... PRIVATE KEY and BEGIN CERTIFICATE, then wrote an evidence marker.

Evidence:

  • AppHost source: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-executable/PemExecutableCheck/apphost.cs
  • Start output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-executable/start-output.txt
  • Evidence marker: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-executable/pem-executable-evidence.txt
  • AppHost key log lines: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-executable/start-log-key-lines.txt
  • AppHost log tail: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-executable/start-log-tail.txt

Observations:

  • Evidence marker contains combined PEM OK and the generated .pem path.
  • The executable reached Running/ready state according to AppHost logs.
  • aspire wait, describe, and stop could not rediscover the file-based AppHost by path after aspire start; cleanup used the recorded AppHost PID. The PEM behavior under test had already completed successfully.

Expected Boundary Outcome: Referencing only CertificateWithKeyPath should still request private-key material and generate a combined PEM file. This passed.


Scenario 3: Container combined PEM runtime

Objective: Verify a container resource receives the new combined PEM file inside the container when only CertificateWithKeyPath is referenced.
Coverage Type: Runtime boundary/regression
Status: ✅ Passed

Steps:

  1. Verified Docker was available (docker info reported server version 29.5.2).
  2. Created a fresh aspire-empty C# AppHost from the PR package hive.
  3. Replaced the AppHost with an Alpine container configured with a self-signed certificate.
  4. Set ASPIRE_CERT_WITH_KEY from ctx.CertificateWithKeyPath, bind-mounted the AppHost directory to /evidence, and ran an Alpine shell command that validated the PEM file content.
  5. The container wrote an evidence marker through the bind mount after confirming both private key and certificate PEM blocks were present.

Evidence:

  • AppHost source: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/PemContainerCheck/apphost.cs
  • Start output: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/start-output.txt
  • Evidence marker: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/pem-container-evidence.txt
  • AppHost key log lines: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/start-log-key-lines.txt
  • AppHost log tail: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/start-log-tail.txt
  • Docker cleanup check: /var/folders/97/44fp_02d4kd90s9p6sy_jwgh0000gn/T/aspire-pr-test-18216-XXXXXX.EE4XIJKOyB/scenario-container/docker-ps-after-cleanup.txt

Observations:

  • Evidence marker contains combined PEM OK and an in-container path under /usr/lib/ssl/aspire/private/*.pem.
  • This exercises the changed ContainerCreator code path that writes <thumbprint>.pem when IsCertificateWithKeyPathReferenced is true.
  • As in Scenario 2, follow-up aspire wait/describe/stop could not rediscover the file-based AppHost by path after aspire start; cleanup used the recorded AppHost PID. The container PEM behavior under test had already completed successfully.

Expected Boundary Outcome: Referencing only CertificateWithKeyPath should still request private-key material and inject a combined PEM file into the container. This passed.

Summary

Scenario Status Notes
Dogfood artifact verification ✅ Passed Installed version matched PR head short SHA e8c5949a.
Executable combined PEM runtime ✅ Passed Executable validated combined private-key + certificate PEM with only CertificateWithKeyPath referenced.
Container combined PEM runtime ✅ Passed Alpine container validated injected combined PEM with only CertificateWithKeyPath referenced.

Overall Result

✅ PR VERIFIED

Recommendations

  • The PR's core runtime behavior was verified for both executable and container resources.
  • The file-based AppHost rediscovery issue observed with aspire wait/describe/stop should be treated separately from this PR unless it is already tracked.

@danegsta
David Negstad (danegsta) merged commit a3bf950 into microsoft:main Jun 19, 2026
342 checks passed
@github-actions github-actions Bot added this to the 13.5 milestone Jun 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a concatenated certificate+key PEM file to TLS paths

3 participants