Skip to content

Follow-ups from #122: name validation, race handling, httpreq append - #126

Merged
0xFelix merged 8 commits into
mainfrom
issue-123-124-followups
Nov 5, 2026
Merged

0xFelix merged 8 commits into
mainfrom
issue-123-124-followups

Conversation

@0xFelix

@0xFelix 0xFelix commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Validate request names against hostname rules in all binders, * only as the leftmost label (Request names are not validated before they are used in Hetzner API paths #124)
  • Retry a failed create via update; respond with 409 if a conflicting RRSet was created concurrently
  • /httpreq/present appends TXT values, so apex and wildcard challenges can coexist; document present/cleanup behavior per endpoint
  • Escape TXT control characters as \DDD instead of Go-style \x01
  • Add hetzner.WaitForAction, rename updateRRSet to setRRSetRecords
  • Unit tests for RRSetTypeFromString, add records to AGENTS.md

Unknown JSON keys are still accepted, rejecting them could break existing clients.

Tested against the live API

  • Duplicate create returns 409 uniqueness_error, a CNAME next to another type returns 422 invalid_input. Both are handled by the retry.
  • \x01 in a TXT value was served as the literal x01, \001 is served as byte 0x01.
  • Invalid names get 400 without an API call, wildcard records work.
  • Concurrent presents (plain, httpreq, CNAME vs TXT, 3 runs each) all went through the retry path: 200/200, both httpreq values kept, CNAME vs TXT always 200/409.

Closes #123
Closes #124

🤖 Generated with Claude Code

0xFelix and others added 8 commits November 5, 2026 10:08
Names from requests were only lowercased and stripped of trailing dots
before being used in Hetzner API paths, which are built without escaping.
Validate them against hostname rules in SplitFQDN, allowing '*' only as
the leftmost label. The acmedns binder validates again after adding the
_acme-challenge prefix.

Fixes #124

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
Deduplicate waiting for actions in the updater and the cleaner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
The name now matches the API call it wraps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
Two concurrent presents for the same new RRSet both tried to create it,
so the second one failed with 500. After a failed create, look up the
RRSet again and apply the value to it if it exists now. If a conflicting
RRSet was created instead, respond with 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
Present replaced the whole RRSet while cleanup removed only the given
value. With lego, issuing a certificate for example.com and
*.example.com presents two values for the same name before validating,
so the second present overwrote the first. Append the value instead and
document the present and cleanup behavior of all endpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
QuoteIfRequired used strconv.Quote, which escapes control characters
Go-style (e.g. \x01). Escape them as \DDD as defined by RFC 1035.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: 0xFelix <felix@matouschek.org>
@0xFelix
0xFelix merged commit fb4a637 into main Nov 5, 2026
5 checks passed
@0xFelix
0xFelix deleted the issue-123-124-followups branch November 5, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant