mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.7k stars 111 forks source link

UI Error hardfail for named strings SPFResult #161

Closed RobSlgm closed 1 month ago

RobSlgm commented 7 months ago

For the past few days, I've been encountering a recurring error for the email domain redacted.com within the UI popup on http://127.0.0.1/admin/#domains/redacted.com/dmarc:

Error: result[0].Records[0].AuthResults.SPF[0].Result: unknown value hardfail for named strings SPFResult

The overview http://127.0.0.1/admin/#dmarc/reports lists for redacted.com DMARC "quarantine"/"reject": 0/1, DKIM "fail": 1, SPF "fail" 3

Investigation:

Possible Cause:

mjl- commented 7 months ago

The error message is coming from the typescript code that verifies the fields in the report against the types. "hardfail" is not a valid SPF result. If a remote server sends it, the Go code will accept it (that's how these types work in Go), but the typescript code will fail on it.

I think it's not helpful for the Go code to reject the report too. It isn't very harmful, and other valid values could be defined in future RFC's. It's better to make sure the typescript code doesn't fail on these values. Right now, all frontend code is strictly typechecking all incoming data from mox api's. Making an exception isn't great. I'll investigate if we can simply represent the SPFResult type (and similarly for dkim and dmarc results) as strings instead of a typescript enum.

mjl- commented 6 months ago

@RobSlgm the commit just now rewrites the not-quite-Go-enums into untyped strings so the runtime-type-checking code of the typescript api doesn't try to enforce valid enum values. the same applied to tls reports. i think i got all the not-quite-enums in the dmarc & tls reports.

RobSlgm commented 1 month ago

Fixed in v0.0.12