diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4af29..712aa4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,19 @@ https://git.coffeylabs.org/inbuxa/inbuxa-admin/releases. Every version PR adds that version's entry here. CI refuses a version this file has no entry for (`tools/changelog-check.sh`). +## [2026.10.26.9] - 2026-11-18 + +A fix to the DNS setup pages for the 2026 series; 27.1 gets it in its +next release candidate. + +### Fixed +- DNS setup: a domain's own DMARC or SPF record, valid but not the one + inbuxa suggests (other report addresses, an extra include), now shows + as "Your own record, valid" and counts toward "All set". The amber mark + and its note about cached records stay for records that really differ: + two SPF records, a DMARC with no policy, an MX or DKIM key elsewhere. + (#239) + ## [2026.10.26.8] - 2026-11-18 A fix to the Security overview for the 2026 series; 27.1 gets it in its diff --git a/inbuxa-version.json b/inbuxa-version.json index 8794094..4e5496f 100644 --- a/inbuxa-version.json +++ b/inbuxa-version.json @@ -1,3 +1,3 @@ { - "version": "2026.10.26.8" + "version": "2026.10.26.9" } diff --git a/src/features/dns/ConnectDnsPage.tsx b/src/features/dns/ConnectDnsPage.tsx index 62ec8e5..b4b75da 100644 --- a/src/features/dns/ConnectDnsPage.tsx +++ b/src/features/dns/ConnectDnsPage.tsx @@ -9,6 +9,7 @@ import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { AlertTriangle, + BadgeCheck, ChevronDown, ClipboardCopy, ClipboardList, @@ -37,7 +38,8 @@ import type { JmapSetError, JmapSetResponse } from '@/types/jmap'; import { ADVANCED_FIELDS, FEATURED, HIDDEN_VARIANTS, type ProviderGuide } from './providers'; import { DEFAULT_KINDS, RECORD_GROUPS } from './records'; import { parseZone, summarizeFailure, type RecordKind, type ZoneRecord } from './zone'; -import { RESOLVER_NAME, type LiveState } from './liveCheck'; +import { RESOLVER_NAME } from './liveCheck'; +import type { RecordState } from './recordState'; import { detectHosting, type DnsHosting } from './detect'; import { useRecordChecks } from './useRecordChecks'; import { CopyStep } from './CopyStep'; @@ -892,7 +894,7 @@ function CredentialField({ ); } -function RecordTable({ records, states }: { records: ZoneRecord[]; states?: Map }) { +function RecordTable({ records, states }: { records: ZoneRecord[]; states?: Map }) { return (
@@ -1026,6 +1028,15 @@ function LiveStep({ )} + {records.some((r) => states.get(r) === 'valid') && ( +

+ + {t( + 'dnsWizard.ownValidHelp', + 'A green badge means the domain already has a valid record of its own there, so it counts as done. Use the value shown only if you want to change it.', + )} +

+ )} {records.some((r) => states.get(r) === 'different') && (

diff --git a/src/features/dns/CopyStep.tsx b/src/features/dns/CopyStep.tsx index 7c031e5..b186959 100644 --- a/src/features/dns/CopyStep.tsx +++ b/src/features/dns/CopyStep.tsx @@ -6,7 +6,7 @@ import { useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { AlertTriangle, Check, Copy, RefreshCw } from 'lucide-react'; +import { AlertTriangle, BadgeCheck, Check, Copy, RefreshCw } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { WizardNote, WizardShell } from '@/components/wizard/WizardShell'; @@ -190,6 +190,15 @@ export function CopyStep({ ); })} + {records.some((r) => states.get(r) === 'valid') && ( +

+ + {t( + 'dnsWizard.ownValidHelp', + 'A green badge means the domain already has a valid record of its own there, so it counts as done. Use the value shown only if you want to change it.', + )} +

+ )} {records.some((r) => states.get(r) === 'different') && (

diff --git a/src/features/dns/parts.tsx b/src/features/dns/parts.tsx index d27ab7e..49e04da 100644 --- a/src/features/dns/parts.tsx +++ b/src/features/dns/parts.tsx @@ -4,15 +4,25 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { AlertTriangle, CheckCircle2, CircleDashed, Loader2, XCircle } from 'lucide-react'; +import { AlertTriangle, BadgeCheck, CheckCircle2, CircleDashed, Loader2, XCircle } from 'lucide-react'; import { cn } from '@/lib/utils'; -import type { LiveState } from './liveCheck'; +import { useTranslation } from 'react-i18next'; +import type { RecordState } from './recordState'; /** One record's state in public DNS, as an icon. */ -export function StateIcon({ state }: { state?: LiveState }) { +export function StateIcon({ state }: { state?: RecordState }) { + const { t } = useTranslation(); switch (state) { case 'live': return ; + case 'valid': { + const label = t('dnsWizard.ownValid', 'Your own record, valid'); + return ( + + + + ); + } case 'different': return ; case 'error': diff --git a/src/features/dns/recordState.test.ts b/src/features/dns/recordState.test.ts new file mode 100644 index 0000000..01a8494 --- /dev/null +++ b/src/features/dns/recordState.test.ts @@ -0,0 +1,65 @@ +/* + * SPDX-FileCopyrightText: 2026 Coffey Labs LLC + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { describe, expect, it } from 'vitest'; +import type { LiveResult } from './liveCheck'; +import { isDone, recordStates } from './recordState'; +import type { ZoneRecord } from './zone'; + +const rec = (kind: ZoneRecord['kind'], name: string, type: string, value: string) => + ({ kind, name, type, value }) as ZoneRecord; + +const dmarc = rec('dmarc', '_dmarc.example.com.', 'TXT', 'v=DMARC1; p=reject; rua=mailto:postmaster@example.com'); +const spf = rec('spf', 'example.com.', 'TXT', 'v=spf1 mx -all'); +const mx = rec('mx', 'example.com.', 'MX', '10 mail.example.com.'); + +const states = (pairs: [ZoneRecord, LiveResult][]) => + recordStates( + pairs.map(([r]) => r), + new Map(pairs), + ); + +describe('recordStates (#239)', () => { + it('a DMARC of the domain’s own, with its own report addresses, is valid and counts as done', () => { + const s = states([[dmarc, { state: 'different', found: ['v=DMARC1; p=quarantine; rua=mailto:dmarc@example.org'] }]]); + expect(s.get(dmarc)).toBe('valid'); + expect(isDone(s.get(dmarc))).toBe(true); + }); + + it('an SPF with an extra include, next to a site verification, is valid', () => { + const s = states([ + [spf, { state: 'different', found: ['google-site-verification=abc', 'v=spf1 mx include:_spf.example.net -all'] }], + ]); + expect(s.get(spf)).toBe('valid'); + }); + + it('two SPF records, or a DMARC with no policy, still differ', () => { + const s = states([ + [spf, { state: 'different', found: ['v=spf1 mx -all', 'v=spf1 a ~all'] }], + [dmarc, { state: 'different', found: ['v=DMARC1; rua=mailto:dmarc@example.org'] }], + ]); + expect(s.get(spf)).toBe('different'); + expect(s.get(dmarc)).toBe('different'); + expect(isDone(s.get(spf))).toBe(false); + }); + + it('a name with only other TXT records still differs, as a live check says', () => { + const s = states([[spf, { state: 'different', found: ['google-site-verification=abc'] }]]); + expect(s.get(spf)).toBe('different'); + }); + + it('an MX elsewhere differs; live, missing and error pass through', () => { + const s = states([ + [mx, { state: 'different', found: ['10 mx.elsewhere.example.'] }], + [dmarc, { state: 'live', found: [] }], + [spf, { state: 'missing', found: [] }], + ]); + expect(s.get(mx)).toBe('different'); + expect(s.get(dmarc)).toBe('live'); + expect(s.get(spf)).toBe('missing'); + expect(recordStates([mx], new Map()).get(mx)).toBe('error'); + }); +}); diff --git a/src/features/dns/recordState.ts b/src/features/dns/recordState.ts new file mode 100644 index 0000000..4a58b7d --- /dev/null +++ b/src/features/dns/recordState.ts @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: 2026 Coffey Labs LLC + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/** + * Where each record on the DNS setup pages stands. Like a live check, except + * that a DMARC or SPF record of the domain's own, which is well formed, is + * `valid` instead of `different` (#239): the admin chose it, it works, and it + * counts as done. + */ +import { coreState } from '@/features/hovercards/facts'; +import type { LiveResult, LiveState } from './liveCheck'; +import type { ZoneRecord } from './zone'; + +export type RecordState = LiveState | 'valid'; + +export function recordStates(records: ZoneRecord[], results: Map): Map { + return new Map( + records.map((r): [ZoneRecord, RecordState] => { + const result = results.get(r) ?? { state: 'error', found: [] }; + if (result.state === 'different' && (r.kind === 'dmarc' || r.kind === 'spf')) { + if (coreState(r.kind, [result]) === 'valid') return [r, 'valid']; + } + return [r, result.state]; + }), + ); +} + +/** Published and usable: the suggested value, or a valid record of the domain's own. */ +export function isDone(state: RecordState | undefined): boolean { + return state === 'live' || state === 'valid'; +} diff --git a/src/features/dns/useRecordChecks.ts b/src/features/dns/useRecordChecks.ts index 941c1f2..5c00674 100644 --- a/src/features/dns/useRecordChecks.ts +++ b/src/features/dns/useRecordChecks.ts @@ -6,7 +6,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { getAccountId, jmapQueryAndGet } from '@/services/jmap/client'; -import { checkRecords, type LiveState } from './liveCheck'; +import { checkRecordValues } from './liveCheck'; +import { isDone, recordStates, type RecordState } from './recordState'; import type { ZoneRecord } from './zone'; export interface DnsTask { @@ -25,7 +26,7 @@ const GIVE_UP_MS = 10 * 60_000; * domain. `task` is undefined until first read, null when none is queued. */ export function useRecordChecks(records: ZoneRecord[], domainId: string, watchTask: boolean) { - const [states, setStates] = useState>(new Map()); + const [states, setStates] = useState>(new Map()); const [task, setTask] = useState(undefined); const [checking, setChecking] = useState(false); const [lastChecked, setLastChecked] = useState(null); @@ -44,7 +45,7 @@ export function useRecordChecks(records: ZoneRecord[], domainId: string, watchTa setTask(null); } } - setStates(await checkRecords(records)); + setStates(recordStates(records, await checkRecordValues(records))); setLastChecked(new Date()); setChecking(false); }, [domainId, records, watchTask]); @@ -66,7 +67,8 @@ export function useRecordChecks(records: ZoneRecord[], domainId: string, watchTa }; }, [check]); - const liveCount = records.filter((r) => states.get(r) === 'live').length; + // A valid DMARC or SPF of the domain's own counts as done (#239). + const liveCount = records.filter((r) => isDone(states.get(r))).length; return { states, task, diff --git a/src/i18n/en.json b/src/i18n/en.json index de3906a..63d9421 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1068,7 +1068,9 @@ "failedSaid": "Your DNS host said:", "failedHelp": "Check that the credential can edit this zone, then fix it on the DNS provider’s page. The server retries on its own.", "differentHelp": "An amber mark means that name has a different value right now, often an old record that hasn’t expired from caches yet.", - "tabTitle": "Publish DNS" + "tabTitle": "Publish DNS", + "ownValidHelp": "A green badge means the domain already has a valid record of its own there, so it counts as done. Use the value shown only if you want to change it.", + "ownValid": "Your own record, valid" }, "dnsCopy": { "copied": "Copied",