Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmarc.Lookup() merges multiple TXT records into a single string #57

Closed
wttw opened this issue Oct 11, 2023 · 2 comments
Closed

dmarc.Lookup() merges multiple TXT records into a single string #57

wttw opened this issue Oct 11, 2023 · 2 comments

Comments

@wttw
Copy link

wttw commented Oct 11, 2023

net.LookupTXT() returns a slice of strings, with one string for each TXT resource record returned. If there are multiple strings inside a TXT record it concatenates those before returning it.

dmarc.LookupWithOptions then concatenates all of those TXT resource records into a single string before parsing it.

If there are multiple TXT records for _dmarc.example.com it'll likely give the wrong response. That's not going to happen in
a healthy DNS zone, but it happens occasionally.

I think that correct behaviour would be for dmarc.LookupWithOptions to remove any TXT records that don't start with "v=", then return an error if there are more than one, then parse just the first remaining TXT RR, if any.

@emersion
Copy link
Owner

Section 6.6.3 says that we should indeed ignore TXT records that do not start with v=.

@emersion
Copy link
Owner

emersion commented Jan 5, 2024

This actually causes more issues: #62

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

No branches or pull requests

2 participants