Ephenodrom / Dart-Acme-Client

ACME client written in Dart.
MIT License
3 stars 5 forks source link

ChallengeError is failing when parsing json due to incorrect 'status' type. #7

Closed bsutton closed 11 months ago

bsutton commented 11 months ago

I'm seeing a cast exception when ChallengeErrorFromJson is being thrown due to a '400'.

The problem is that the code assumes the status is a string but it would appear that acme is returning an it.

Map (3 items)
"type" -> "urn:ietf:params:acme:error:connection"
"detail" -> "34.69.220.126: Fetching http://xxxxxx/.well-known/acme-challenge/XXXXX Timeout d…"
"status" -> 400

Note the status is an int.

The timeout is occurring as I'm behind a NAT which isn't configured correct but this still seems to be an issue that needs to be looked at.

What I'm not certain is whether the status is always an int.

I found this issue whilst trying to get shelf_letsencrypt running.

I've also reported an issue there:

https://github.com/gmpassos/shelf_letsencrypt/issues/9

Ephenodrom commented 11 months ago

The package was written by me to better understand the ACME protocol, so it may well be that there are still one or two bugs here. In the end, however, I was able to issue certificates via Let's Encrypt under real conditions. I am not sure if this is a special issue, cause i cannot find "urn:ietf:params:acme:error:connection" in the RFC. I would suggest to change it to an int and then try to manually issue a certificate via Let's encrypt by writing a small dart script to invoke the methods manually. If you can confirm that the package is still working we can change the string to int.

bsutton commented 11 months ago

I've changed it to an int? and I can issue a certificate and the code works if I force an error.

On Sun, 10 Dec 2023, 1:19 am Ephenodrom, @.***> wrote:

The package was written by me to better understand the ACME protocol, so it may well be that there are still one or two bugs here. In the end, however, I was able to issue certificates via Let's Encrypt under real conditions. I am not sure if this is a special issue, cause i cannot find "urn:ietf:params:acme:error:connection" in the RFC. I would suggest to change it to an int and then try to manually issue a certificate via Let's encrypt by writing a small dart script to invoke the methods manually. If you can confirm that the package is still working we can change the string to int.

— Reply to this email directly, view it on GitHub https://github.com/Ephenodrom/Dart-Acme-Client/issues/7#issuecomment-1848423358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OBG4HTUNXORQIVEYBDYIRXO5AVCNFSM6AAAAABAMRWSG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBYGQZDGMZVHA . You are receiving this because you authored the thread.Message ID: @.***>

Ephenodrom commented 11 months ago

@bsutton Ok sounds good.