Skip to content

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

Open
aradalvand wants to merge 4 commits into
microsoft:mainfrom
aradalvand:certificate-with-key-pem
Open

Include concatenated certificate+key PEM file in TLS contexts#18216
aradalvand wants to merge 4 commits into
microsoft:mainfrom
aradalvand:certificate-with-key-pem

Conversation

@aradalvand

@aradalvand 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 aradalvand force-pushed the certificate-with-key-pem branch from 05b41e1 to 06b9d9f Compare June 15, 2026 17:21
@aradalvand aradalvand force-pushed the certificate-with-key-pem branch from 06b9d9f to 5cbbe33 Compare June 15, 2026 17:21
@aradalvand aradalvand changed the title introduce concatenated certificate+key PEM file for TLS Include concatenated certificate+key PEM file in TLS contexts Jun 15, 2026
Comment thread src/Aspire.Hosting/Dcp/ContainerCreator.cs Outdated
Comment thread src/Aspire.Hosting/Dcp/ContainerCreator.cs Outdated
@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?

@aradalvand aradalvand force-pushed the certificate-with-key-pem branch from 9950095 to 0111686 Compare June 15, 2026 19:00
@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.

/// A value provider that will resolve to a path to the the certificate and key concatenated together in PEM format.
/// </summary>
[AspireExport]
public required ReferenceExpression CertificateWithKeyPath { get; init; }

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.

There are tests that check for unexpected changes in the polyglot AppHost generated code for all the current supported and experimental languages. You'll need to re-run the CodeGeneration test cases for each of the supported languages and accept the new snapshots with dotnet verify accept -y.

@aradalvand aradalvand Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there any way to selectively run the code-generating tests only?
Even if not, how do I exactly find them? Is there a consistent convention? I couldn't find any specific instructions related to this in CONTRIBUTING.md.

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.

They're a bit awkward and not well documented; it's the Hosting.CodeGeneration.* tests (which test multiple different languages, including ones that are still early experimental) to ensure we don't accidentally regress anything when making API changes.

/// <summary>
/// Indicates whether the certificate-with-key path was actually referenced in the resource configuration.
/// </summary>
public bool IsCertificateWithKeyPathReferenced => _trackedCertificateWithKeyPathReference?.WasResolved ?? false;

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.

You'll also need to update HttpsCertificateExecutionConfigurationExportData with these properties to ensure polyglot code can reference these properties.

@aradalvand aradalvand Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By "these properties", do you mean the Is*Referenced properties? I'm confused. Are you saying these should be added to HttpsCertificateExecutionConfigurationExportData? That class never contained such properties though? Not even previously for KeyPath and PfxPath.

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.

It's specifically a helper used for code-generation of polyglot AppHosts (so producing the RPC compatible types for things like TypeScript apphosts). It's not an exact 1:1, but there's KeyPathExpression and PfxPathExpression, for example, plus the GetHttpsCertificateData method that populates them.

Comment thread src/Aspire.Hosting/Dcp/ContainerCreator.cs Outdated
Comment thread src/Aspire.Hosting/Dcp/ExecutableCreator.cs Outdated
@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.

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.

Add a concatenated certificate+key PEM file to TLS paths

2 participants