Skip to content

test badNonce retry exhaustion and RFC 8555 violation paths - #85

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-badnonce-edge-cases
Draft

test badNonce retry exhaustion and RFC 8555 violation paths#85
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-badnonce-edge-cases

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What

Add tests for two untested edge cases in HTTP.pm's badNonce retry logic.

Why

The retry mechanism had two unexercised branches — retry exhaustion and
RFC 8555/6.5 violation (missing Replay-Nonce on error response). Both are
production failure modes: a misbehaving ACME server could trigger either
path, and bugs here would be invisible until that happened.

How

  • Retry exhaustion: force _retries_left to 0, send a badNonce error,
    verify the warning fires and the error is re-thrown (not looped or swallowed).
  • RFC violation: send a badNonce error response with no Replay-Nonce
    header, verify the RFC 8555/6.5 warning fires, no retry is attempted, and
    the error is re-thrown.

Both tests capture warnings via $SIG{__WARN__} (same pattern as the
existing badNonce retry test).

Testing

Full suite: 382 tests pass. HTTP test file: 60 assertions (was 50), 10 new.


Quality Report

Changes: 1 file changed, 167 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

Two untested edge cases in HTTP.pm's badNonce handling:
- retry exhaustion: when all retries are consumed, the error
  must be re-thrown with a warning, not loop or silently fail
- missing Replay-Nonce: when the server omits the nonce header
  from a badNonce error response (violating RFC 8555/6.5),
  the client must warn and give up, not retry without a nonce
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.

1 participant