Preserve CSR extensions during simpleenroll - #65
Merged
jjrdk merged 3 commits intoSep 1, 2026
Conversation
added 3 commits
September 1, 2026 10:12
…simpleenroll Adds an EST server scenario that submits a CSR requesting a specific X509KeyUsageExtension and asserts the issued certificate carries that same extension. This currently fails because SimpleEnrollHandler loads the CSR without CertificateRequestLoadOptions.UnsafeLoadCertificateExtensions, silently dropping all CSR extensions before the certificate is signed.
CertificateRequest.LoadSigningRequest defaults to CertificateRequestLoadOptions.Default, which does not populate CertificateExtensions from the parsed CSR. Because SignCertificateRequest copies extensions from the CertificateRequest it is given, this caused all CSR extensions (SAN, KeyUsage, EKU, etc.) requested via /simpleenroll to be silently dropped from the issued certificate. SimpleReEnrollHandler and ServerKeyGenHandler already pass CertificateRequestLoadOptions.UnsafeLoadCertificateExtensions; this brings SimpleEnrollHandler in line with them. Fixes the failing scenario added in the previous commit.
Owner
|
That does seem like an oversight. Thank you for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64
Problem
SimpleEnrollHandler.HandleProfilecallsCertificateRequest.LoadSigningRequestwithoutCertificateRequestLoadOptions.UnsafeLoadCertificateExtensions, so the parsed CSR'sCertificateExtensionsis always empty.SignCertificateRequestcopies extensions from thatCertificateRequest, so any extension requested in the CSR (SAN, KeyUsage, EKU, ...) is silentlydropped from the certificate issued via
/simpleenroll.SimpleReEnrollHandlerandServerKeyGenHandleralready pass this flag - this bringsSimpleEnrollHandlerin line with them.Fix
Add the missing
CertificateRequestLoadOptions.UnsafeLoadCertificateExtensionsflag to theLoadSigningRequestcall inSimpleEnrollHandler.Tests
Added two
Scenario Outlines (rsa + ecdsa) toEstServer.feature, verified red before the fix andgreen after:
KeyUsageextension matches what was requested.SubjectAlternativeNameBuilder.AddUriSAN entry (sinceEstClient.Enrollhas no API for custom SANextensions) and asserts it survives
/simpleenrollintact. This reproduces the real-world casedescribed in the linked issue.
Also ran the full
opencertserver.certserver.testssuite to confirm no regressions - the 67pre-existing failures there are unrelated ACME/
CertesSlimissues, unaffected by this change.