Skip to content

Match exact record data when rediscovering IDs for deletion#5

Open
bjornmp wants to merge 1 commit into
libdns:masterfrom
bjornmp:robust-delete-records
Open

Match exact record data when rediscovering IDs for deletion#5
bjornmp wants to merge 1 commit into
libdns:masterfrom
bjornmp:robust-delete-records

Conversation

@bjornmp
Copy link
Copy Markdown

@bjornmp bjornmp commented May 9, 2026

Summary

This change makes DeleteRecords match existing records by name, type, and data when it needs to rediscover a Njalla record ID. Previously the fallback lookup matched only name and type.

Why

When DeleteRecords is called without provider-specific ID data, the provider has to list records and find the matching Njalla ID before calling remove-record.

Matching only name and type is not precise enough. Multiple TXT records with the same name and type can exist at the same time, with different values. The fallback lookup should therefore include the record data/value to avoid deleting the wrong record.

Related: caddyserver/certmagic#382 would preserve provider metadata during CertMagic DNS-01 cleanup, making Njalla's provider ID available more often and reducing how often this fallback path is needed there. This fallback should still be correct for callers that pass only portable DNS record data without provider-specific ID metadata.

Validation

Added regression unit tests for:

  • no-ID deletion lookup selecting the TXT record with matching content
  • no-ID deletion after AppendRecords(...).RR() drops provider-specific metadata

Tested with:

go test ./...

Fixes #4

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.

DeleteRecords fallback should match exact record data

1 participant