Skip to content

Label an IPv6 public address as AAAA, not A, in the DNS dialogs - #101

Closed
bluzername wants to merge 1 commit into
BitMiracle-AI:mainfrom
bluzername:fix-ipv6-aaaa-record-type
Closed

bluzername wants to merge 1 commit into
BitMiracle-AI:mainfrom
bluzername:fix-ipv6-aaaa-record-type

Conversation

@bluzername

Copy link
Copy Markdown

Fixes #55.

BindDomainDialog and SandboxDomainCard both hard-code the DNS record type row to 'A'. The value next to it come from detectPublicIp, which pick the first address out of an ingress probe's dnsAddresses without checking if it is IPv4 or IPv6. If the only probed address is IPv6, the dialog show record type A with an IPv6 value, which Node itself reject as invalid for an A record. An IPv6-only operator would copy an instruction that cannot work.

Change: added dnsRecordType(ip) to packages/console/src/features/ingress/lib/publicIp.ts. It just check for a colon, every IPv6 textual form has one and no IPv4 dotted-quad does. Both dialogs (BindDomainDialog.tsx, SandboxDomainCard.tsx) now call it instead of the hard-coded string, falling back to 'A' only when there is no public IP yet (placeholder state, unchanged from before).

Test: added publicIp.test.ts with three cases, an IPv4 address, a compressed IPv6 address, and a full-form IPv6 address. Without dnsRecordType the test fail with "dnsRecordType is not a function". With the fix all three pass.

Ran the full chain locally: pnpm build && pnpm typecheck && pnpm lint && pnpm test (server 681 passed, console 28 passed, sdk 31 passed, cli 64 passed, e2e 92 passed). No changeset since this only touch @dormice/console, not the published packages.

Both BindDomainDialog and SandboxDomainCard hard-code the DNS record
type to A, but the address they display come from detectPublicIp,
which just take the first address in an ingress probe without
checking if it is IPv4 or IPv6. When the only probed address is IPv6,
the dialog show record type A next to a value that is not valid for
an A record, so an IPv6-only operator get a copyable instruction that
cannot work.

Added dnsRecordType(ip) in publicIp.ts, it just check for a colon
since every IPv6 textual form has one and no IPv4 dotted-quad does.
Both dialogs now use it instead of the hard-coded 'A'.

Test: publicIp.test.ts checks dnsRecordType on an IPv4 address, a
compressed IPv6 address and a full-form IPv6 address. Without the
function the test fail with "dnsRecordType is not a function", and
after the fix all three pass.
@Annactswell

Copy link
Copy Markdown
Contributor

Thank you for taking the time to work on this.

Dormice runs production fleets for several commercial services, and we have made the decision to keep code changes within the maintaining team so that every line is written, reviewed and verified on real hosts by the people who carry that responsibility. The policy is written up in CONTRIBUTING.md:
https://github.com/BitMiracle-AI/Dormice/blob/main/CONTRIBUTING.md

This is about how the project is run, not about your patch. The issue it addresses (#55) stays open; when the fix lands we will credit you there and in the commit. If your PR contains reasoning that is not already in the issue, please add it to the issue so it is not lost.

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.

console: IPv6 addresses are labeled as DNS A records

2 participants