Skip to content

Resolve relative DEV_PROXY_CERT_PATH against config folder - #1949

Merged
waldekmastykarz merged 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-relative-cert-path
Oct 21, 2026
Merged

waldekmastykarz merged 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-relative-cert-path

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

Closes #1947

In the Kestrel engine, CertificateAuthority.CreateDefault only honored DEV_PROXY_CERT_PATH when it was rooted, otherwise falling back to <configDir>/rootCert.pfx. The Docker images set DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx, so the root certificate ended up outside the mounted rootCert volume and was regenerated on each container run.

This change resolves a relative DEV_PROXY_CERT_PATH against the config folder, matching v3.3.1 (Titanium CertificateDiskCache.GetRootCertificatePath). Rooted paths are used as-is and an empty value still falls back to <configDir>/rootCert.pfx.

Added unit tests for path resolution and for persisting the root into a relative subfolder.

…tnet#1947

The Kestrel CertificateAuthority ignored a relative DEV_PROXY_CERT_PATH and
fell back to <configDir>/rootCert.pfx. The Docker images set
DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx, so the root certificate was
written outside the mounted rootCert volume. Resolve relative values against
the config folder, matching v3.3.1 (Titanium) behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6bef9494-04d4-42fb-bd36-c84a4b6ed44f
@waldekmastykarz
waldekmastykarz requested a review from a team as a code owner October 21, 2026 13:11
Copilot AI balanced review requested due to automatic review settings October 21, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused fix matches the reported requirements, includes regression tests, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes #1947 by resolving relative certificate paths against the config folder, allowing Docker’s mounted rootCert volume to persist the certificate across runs.

Changes:

  • Preserves rooted paths and the default for unset or empty values.
  • Adds path-resolution and subfolder-persistence tests.
File Description
DevProxy.Proxy.Kestrel/​Internal/​CertificateAuthority.cs Resolves relative certificate paths and documents the behavior.
DevProxy.Proxy.Kestrel.Tests/​CertificateAuthorityTests.cs Tests path resolution and certificate persistence.

Review effort: Balanced

@waldekmastykarz
waldekmastykarz merged commit 46e96cf into dotnet:main Oct 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants