Guard get_certificate_chain(s) against undef URL#67
Merged
Conversation
Without the guard, calling get_certificate_chain() on an order that hasn't reached 'valid' status produces a confusing "Must be https!" error deep in the HTTP layer, because the certificate URL is undef. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an order hasn't reached 'valid' status, its certificate URL is undef. Previously this propagated to _post_as_get, producing a confusing "Must be https!" error. Now both get_certificate_chain() and get_certificate_chains() throw a clear X::Generic exception that names the current order status and tells the caller to poll. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
Adds an early guard in
get_certificate_chain()andget_certificate_chains()that throws a clearX::Genericexception when the order's certificate URL is not set.Why
When callers invoke these methods on an order that hasn't reached
validstatus,$order->certificate()returnsundef. This propagated into_post_as_get(), eventually producing a confusing low-level error ("Must be https!") with no indication of what went wrong or how to fix it.How
Both methods now check the return value of
$order->certificate()before proceeding. Onundef, they throw a structured exception that names the current order status and tells the caller to poll untilvalid.Testing
t/Net-ACME2-get-certificate-guard.tverifies the guard fires forpendingandprocessingorders🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 107 insertions(+), 2 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline