From 0c800f3d7e38dce90689e91266a002f3b0ad65db Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sat, 9 Mar 2024 15:43:49 +0100 Subject: [PATCH] update to latest sherpats fixing typo in error message, handle absent dmarc "policy override" reason --- dmarcrpt/feedback.go | 2 ++ go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/mjl-/sherpats/ts.go | 4 ++-- vendor/modules.txt | 2 +- webaccount/account.js | 4 ++-- webaccount/api.ts | 4 ++-- webadmin/admin.js | 7 ++++--- webadmin/admin.ts | 2 +- webadmin/api.json | 5 +++++ webadmin/api.ts | 7 ++++--- webmail/api.ts | 4 ++-- webmail/msg.js | 4 ++-- webmail/text.js | 4 ++-- webmail/webmail.js | 4 ++-- 15 files changed, 34 insertions(+), 25 deletions(-) diff --git a/dmarcrpt/feedback.go b/dmarcrpt/feedback.go index 5521405..c9bb285 100644 --- a/dmarcrpt/feedback.go +++ b/dmarcrpt/feedback.go @@ -107,6 +107,8 @@ type PolicyOverrideReason struct { type PolicyOverride string const ( + PolicyOverrideAbsent PolicyOverride = "" + PolicyOverrideForwarded PolicyOverride = "forwarded" PolicyOverrideSampledOut PolicyOverride = "sampled_out" PolicyOverrideTrustedForwarder PolicyOverride = "trusted_forwarder" diff --git a/go.mod b/go.mod index d44cb56..eed91dd 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/mjl-/sherpa v0.6.7 github.com/mjl-/sherpadoc v0.0.12 github.com/mjl-/sherpaprom v0.0.2 - github.com/mjl-/sherpats v0.0.5 + github.com/mjl-/sherpats v0.0.6 github.com/prometheus/client_golang v1.18.0 github.com/russross/blackfriday/v2 v2.1.0 go.etcd.io/bbolt v1.3.9 diff --git a/go.sum b/go.sum index 59dbcff..ee2505c 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/mjl-/sherpadoc v0.0.12 h1:6hVe2Z0DnwjC0bfuOwfz8ov7JTCUU49cEaj7h22NiPk github.com/mjl-/sherpadoc v0.0.12/go.mod h1:vh5zcsk3j/Tvm725EY+unTZb3EZcZcpiEQzrODSa6+I= github.com/mjl-/sherpaprom v0.0.2 h1:1dlbkScsNafM5jURI44uiWrZMSwfZtcOFEEq7vx2C1Y= github.com/mjl-/sherpaprom v0.0.2/go.mod h1:cl5nMNOvqhzMiQJ2FzccQ9ReivjHXe53JhOVkPfSvw4= -github.com/mjl-/sherpats v0.0.5 h1:XJBorAxUY/C8IBjCmu741353Ex7CFXrb53NDGCrBu74= -github.com/mjl-/sherpats v0.0.5/go.mod h1:MoNZJtLmu8oCZ4Ocv5vZksENN4pp6/SJMlg9uTII4KA= +github.com/mjl-/sherpats v0.0.6 h1:2lSoJbb+jkjLOdlvoMxItq0QQrrnkH+rnm3PMRfpbmA= +github.com/mjl-/sherpats v0.0.6/go.mod h1:MoNZJtLmu8oCZ4Ocv5vZksENN4pp6/SJMlg9uTII4KA= github.com/mjl-/xfmt v0.0.2 h1:6dLgd6U3bmDJKtTxsaSYYyMaORoO4hKBAJo4XKkPRko= github.com/mjl-/xfmt v0.0.2/go.mod h1:DIEOLmETMQHHr4OgwPG7iC37rDiN9MaZIZxNm5hBtL8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= diff --git a/vendor/github.com/mjl-/sherpats/ts.go b/vendor/github.com/mjl-/sherpats/ts.go index d1826de..929ecfe 100644 --- a/vendor/github.com/mjl-/sherpats/ts.go +++ b/vendor/github.com/mjl-/sherpats/ts.go @@ -218,7 +218,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named strings ' + t.Name) + error('unknown value ' + v + ' for named strings ' + t.Name) } else if (intsTypes[nt.Name]) { const t = nt as Ints if (typeof v !== 'number' || !Number.isInteger(v)) { @@ -232,7 +232,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named ints ' + t.Name) + error('unknown value ' + v + ' for named ints ' + t.Name) } else { throw new Error('unexpected named type ' + nt) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 47d6724..c74595e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -32,7 +32,7 @@ github.com/mjl-/sherpadoc/cmd/sherpadoc # github.com/mjl-/sherpaprom v0.0.2 ## explicit; go 1.12 github.com/mjl-/sherpaprom -# github.com/mjl-/sherpats v0.0.5 +# github.com/mjl-/sherpats v0.0.6 ## explicit; go 1.12 github.com/mjl-/sherpats github.com/mjl-/sherpats/cmd/sherpats diff --git a/webaccount/account.js b/webaccount/account.js index 9e59b2e..c13e52a 100644 --- a/webaccount/account.js +++ b/webaccount/account.js @@ -514,7 +514,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named strings ' + t.Name); + error('unknown value ' + v + ' for named strings ' + t.Name); } else if (api.intsTypes[nt.Name]) { const t = nt; @@ -529,7 +529,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named ints ' + t.Name); + error('unknown value ' + v + ' for named ints ' + t.Name); } else { throw new Error('unexpected named type ' + nt); diff --git a/webaccount/api.ts b/webaccount/api.ts index d25fafa..d9ab421 100644 --- a/webaccount/api.ts +++ b/webaccount/api.ts @@ -402,7 +402,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named strings ' + t.Name) + error('unknown value ' + v + ' for named strings ' + t.Name) } else if (intsTypes[nt.Name]) { const t = nt as Ints if (typeof v !== 'number' || !Number.isInteger(v)) { @@ -416,7 +416,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named ints ' + t.Name) + error('unknown value ' + v + ' for named ints ' + t.Name) } else { throw new Error('unexpected named type ' + nt) } diff --git a/webadmin/admin.js b/webadmin/admin.js index 8173b6c..cff1d0d 100644 --- a/webadmin/admin.js +++ b/webadmin/admin.js @@ -299,6 +299,7 @@ var api; // was not applied. let PolicyOverride; (function (PolicyOverride) { + PolicyOverride["PolicyOverrideAbsent"] = ""; PolicyOverride["PolicyOverrideForwarded"] = "forwarded"; PolicyOverride["PolicyOverrideSampledOut"] = "sampled_out"; PolicyOverride["PolicyOverrideTrustedForwarder"] = "trusted_forwarder"; @@ -420,7 +421,7 @@ var api; "Alignment": { "Name": "Alignment", "Docs": "", "Values": [{ "Name": "AlignmentAbsent", "Value": "", "Docs": "" }, { "Name": "AlignmentRelaxed", "Value": "r", "Docs": "" }, { "Name": "AlignmentStrict", "Value": "s", "Docs": "" }] }, "Disposition": { "Name": "Disposition", "Docs": "", "Values": [{ "Name": "DispositionAbsent", "Value": "", "Docs": "" }, { "Name": "DispositionNone", "Value": "none", "Docs": "" }, { "Name": "DispositionQuarantine", "Value": "quarantine", "Docs": "" }, { "Name": "DispositionReject", "Value": "reject", "Docs": "" }] }, "DMARCResult": { "Name": "DMARCResult", "Docs": "", "Values": [{ "Name": "DMARCAbsent", "Value": "", "Docs": "" }, { "Name": "DMARCPass", "Value": "pass", "Docs": "" }, { "Name": "DMARCFail", "Value": "fail", "Docs": "" }] }, - "PolicyOverride": { "Name": "PolicyOverride", "Docs": "", "Values": [{ "Name": "PolicyOverrideForwarded", "Value": "forwarded", "Docs": "" }, { "Name": "PolicyOverrideSampledOut", "Value": "sampled_out", "Docs": "" }, { "Name": "PolicyOverrideTrustedForwarder", "Value": "trusted_forwarder", "Docs": "" }, { "Name": "PolicyOverrideMailingList", "Value": "mailing_list", "Docs": "" }, { "Name": "PolicyOverrideLocalPolicy", "Value": "local_policy", "Docs": "" }, { "Name": "PolicyOverrideOther", "Value": "other", "Docs": "" }] }, + "PolicyOverride": { "Name": "PolicyOverride", "Docs": "", "Values": [{ "Name": "PolicyOverrideAbsent", "Value": "", "Docs": "" }, { "Name": "PolicyOverrideForwarded", "Value": "forwarded", "Docs": "" }, { "Name": "PolicyOverrideSampledOut", "Value": "sampled_out", "Docs": "" }, { "Name": "PolicyOverrideTrustedForwarder", "Value": "trusted_forwarder", "Docs": "" }, { "Name": "PolicyOverrideMailingList", "Value": "mailing_list", "Docs": "" }, { "Name": "PolicyOverrideLocalPolicy", "Value": "local_policy", "Docs": "" }, { "Name": "PolicyOverrideOther", "Value": "other", "Docs": "" }] }, "DKIMResult": { "Name": "DKIMResult", "Docs": "", "Values": [{ "Name": "DKIMAbsent", "Value": "", "Docs": "" }, { "Name": "DKIMNone", "Value": "none", "Docs": "" }, { "Name": "DKIMPass", "Value": "pass", "Docs": "" }, { "Name": "DKIMFail", "Value": "fail", "Docs": "" }, { "Name": "DKIMPolicy", "Value": "policy", "Docs": "" }, { "Name": "DKIMNeutral", "Value": "neutral", "Docs": "" }, { "Name": "DKIMTemperror", "Value": "temperror", "Docs": "" }, { "Name": "DKIMPermerror", "Value": "permerror", "Docs": "" }] }, "SPFDomainScope": { "Name": "SPFDomainScope", "Docs": "", "Values": [{ "Name": "SPFDomainScopeAbsent", "Value": "", "Docs": "" }, { "Name": "SPFDomainScopeHelo", "Value": "helo", "Docs": "" }, { "Name": "SPFDomainScopeMailFrom", "Value": "mfrom", "Docs": "" }] }, "SPFResult": { "Name": "SPFResult", "Docs": "", "Values": [{ "Name": "SPFAbsent", "Value": "", "Docs": "" }, { "Name": "SPFNone", "Value": "none", "Docs": "" }, { "Name": "SPFNeutral", "Value": "neutral", "Docs": "" }, { "Name": "SPFPass", "Value": "pass", "Docs": "" }, { "Name": "SPFFail", "Value": "fail", "Docs": "" }, { "Name": "SPFSoftfail", "Value": "softfail", "Docs": "" }, { "Name": "SPFTemperror", "Value": "temperror", "Docs": "" }, { "Name": "SPFPermerror", "Value": "permerror", "Docs": "" }] }, @@ -1208,7 +1209,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named strings ' + t.Name); + error('unknown value ' + v + ' for named strings ' + t.Name); } else if (api.intsTypes[nt.Name]) { const t = nt; @@ -1223,7 +1224,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named ints ' + t.Name); + error('unknown value ' + v + ' for named ints ' + t.Name); } else { throw new Error('unexpected named type ' + nt); diff --git a/webadmin/admin.ts b/webadmin/admin.ts index d895c9f..5aa0714 100644 --- a/webadmin/admin.ts +++ b/webadmin/admin.ts @@ -1246,7 +1246,7 @@ const renderDMARCSummaries = (summaries: api.DMARCSummary[]) => { dom.td(style({textAlign: 'right'}), r.DispositionQuarantine === 0 && r.DispositionReject === 0 ? '0/0' : box(red, '' + r.DispositionQuarantine + '/' + r.DispositionReject)), dom.td(style({textAlign: 'right'}), box(r.DKIMFail === 0 ? green : red, '' + r.DKIMFail)), dom.td(style({textAlign: 'right'}), box(r.SPFFail === 0 ? green : red, '' + r.SPFFail)), - dom.td(!r.PolicyOverrides ? [] : Object.entries(r.PolicyOverrides).map(kv => kv[0] + ': ' + kv[1]).join('; ')), + dom.td(!r.PolicyOverrides ? [] : Object.entries(r.PolicyOverrides).map(kv => ((kv[0] || '(no reason)') + ': ' + kv[1]).join('; ')), ) ), ), diff --git a/webadmin/api.json b/webadmin/api.json index f31aa62..267bea0 100644 --- a/webadmin/api.json +++ b/webadmin/api.json @@ -4492,6 +4492,11 @@ "Name": "PolicyOverride", "Docs": "PolicyOverride is a reason the requested DMARC policy from the DNS record\nwas not applied.", "Values": [ + { + "Name": "PolicyOverrideAbsent", + "Value": "", + "Docs": "" + }, { "Name": "PolicyOverrideForwarded", "Value": "forwarded", diff --git a/webadmin/api.ts b/webadmin/api.ts index 30589a9..9deecff 100644 --- a/webadmin/api.ts +++ b/webadmin/api.ts @@ -726,6 +726,7 @@ export enum DMARCResult { // PolicyOverride is a reason the requested DMARC policy from the DNS record // was not applied. export enum PolicyOverride { + PolicyOverrideAbsent = "", PolicyOverrideForwarded = "forwarded", PolicyOverrideSampledOut = "sampled_out", PolicyOverrideTrustedForwarder = "trusted_forwarder", @@ -865,7 +866,7 @@ export const types: TypenameMap = { "Alignment": {"Name":"Alignment","Docs":"","Values":[{"Name":"AlignmentAbsent","Value":"","Docs":""},{"Name":"AlignmentRelaxed","Value":"r","Docs":""},{"Name":"AlignmentStrict","Value":"s","Docs":""}]}, "Disposition": {"Name":"Disposition","Docs":"","Values":[{"Name":"DispositionAbsent","Value":"","Docs":""},{"Name":"DispositionNone","Value":"none","Docs":""},{"Name":"DispositionQuarantine","Value":"quarantine","Docs":""},{"Name":"DispositionReject","Value":"reject","Docs":""}]}, "DMARCResult": {"Name":"DMARCResult","Docs":"","Values":[{"Name":"DMARCAbsent","Value":"","Docs":""},{"Name":"DMARCPass","Value":"pass","Docs":""},{"Name":"DMARCFail","Value":"fail","Docs":""}]}, - "PolicyOverride": {"Name":"PolicyOverride","Docs":"","Values":[{"Name":"PolicyOverrideForwarded","Value":"forwarded","Docs":""},{"Name":"PolicyOverrideSampledOut","Value":"sampled_out","Docs":""},{"Name":"PolicyOverrideTrustedForwarder","Value":"trusted_forwarder","Docs":""},{"Name":"PolicyOverrideMailingList","Value":"mailing_list","Docs":""},{"Name":"PolicyOverrideLocalPolicy","Value":"local_policy","Docs":""},{"Name":"PolicyOverrideOther","Value":"other","Docs":""}]}, + "PolicyOverride": {"Name":"PolicyOverride","Docs":"","Values":[{"Name":"PolicyOverrideAbsent","Value":"","Docs":""},{"Name":"PolicyOverrideForwarded","Value":"forwarded","Docs":""},{"Name":"PolicyOverrideSampledOut","Value":"sampled_out","Docs":""},{"Name":"PolicyOverrideTrustedForwarder","Value":"trusted_forwarder","Docs":""},{"Name":"PolicyOverrideMailingList","Value":"mailing_list","Docs":""},{"Name":"PolicyOverrideLocalPolicy","Value":"local_policy","Docs":""},{"Name":"PolicyOverrideOther","Value":"other","Docs":""}]}, "DKIMResult": {"Name":"DKIMResult","Docs":"","Values":[{"Name":"DKIMAbsent","Value":"","Docs":""},{"Name":"DKIMNone","Value":"none","Docs":""},{"Name":"DKIMPass","Value":"pass","Docs":""},{"Name":"DKIMFail","Value":"fail","Docs":""},{"Name":"DKIMPolicy","Value":"policy","Docs":""},{"Name":"DKIMNeutral","Value":"neutral","Docs":""},{"Name":"DKIMTemperror","Value":"temperror","Docs":""},{"Name":"DKIMPermerror","Value":"permerror","Docs":""}]}, "SPFDomainScope": {"Name":"SPFDomainScope","Docs":"","Values":[{"Name":"SPFDomainScopeAbsent","Value":"","Docs":""},{"Name":"SPFDomainScopeHelo","Value":"helo","Docs":""},{"Name":"SPFDomainScopeMailFrom","Value":"mfrom","Docs":""}]}, "SPFResult": {"Name":"SPFResult","Docs":"","Values":[{"Name":"SPFAbsent","Value":"","Docs":""},{"Name":"SPFNone","Value":"none","Docs":""},{"Name":"SPFNeutral","Value":"neutral","Docs":""},{"Name":"SPFPass","Value":"pass","Docs":""},{"Name":"SPFFail","Value":"fail","Docs":""},{"Name":"SPFSoftfail","Value":"softfail","Docs":""},{"Name":"SPFTemperror","Value":"temperror","Docs":""},{"Name":"SPFPermerror","Value":"permerror","Docs":""}]}, @@ -1782,7 +1783,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named strings ' + t.Name) + error('unknown value ' + v + ' for named strings ' + t.Name) } else if (intsTypes[nt.Name]) { const t = nt as Ints if (typeof v !== 'number' || !Number.isInteger(v)) { @@ -1796,7 +1797,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named ints ' + t.Name) + error('unknown value ' + v + ' for named ints ' + t.Name) } else { throw new Error('unexpected named type ' + nt) } diff --git a/webmail/api.ts b/webmail/api.ts index 2f55d1b..8dadc76 100644 --- a/webmail/api.ts +++ b/webmail/api.ts @@ -1096,7 +1096,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named strings ' + t.Name) + error('unknown value ' + v + ' for named strings ' + t.Name) } else if (intsTypes[nt.Name]) { const t = nt as Ints if (typeof v !== 'number' || !Number.isInteger(v)) { @@ -1110,7 +1110,7 @@ class verifier { return v } } - error('unknkown value ' + v + ' for named ints ' + t.Name) + error('unknown value ' + v + ' for named ints ' + t.Name) } else { throw new Error('unexpected named type ' + nt) } diff --git a/webmail/msg.js b/webmail/msg.js index 119e435..8c3d9f4 100644 --- a/webmail/msg.js +++ b/webmail/msg.js @@ -757,7 +757,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named strings ' + t.Name); + error('unknown value ' + v + ' for named strings ' + t.Name); } else if (api.intsTypes[nt.Name]) { const t = nt; @@ -772,7 +772,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named ints ' + t.Name); + error('unknown value ' + v + ' for named ints ' + t.Name); } else { throw new Error('unexpected named type ' + nt); diff --git a/webmail/text.js b/webmail/text.js index dc38131..2b548b9 100644 --- a/webmail/text.js +++ b/webmail/text.js @@ -757,7 +757,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named strings ' + t.Name); + error('unknown value ' + v + ' for named strings ' + t.Name); } else if (api.intsTypes[nt.Name]) { const t = nt; @@ -772,7 +772,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named ints ' + t.Name); + error('unknown value ' + v + ' for named ints ' + t.Name); } else { throw new Error('unexpected named type ' + nt); diff --git a/webmail/webmail.js b/webmail/webmail.js index bf0ff3e..e02709b 100644 --- a/webmail/webmail.js +++ b/webmail/webmail.js @@ -757,7 +757,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named strings ' + t.Name); + error('unknown value ' + v + ' for named strings ' + t.Name); } else if (api.intsTypes[nt.Name]) { const t = nt; @@ -772,7 +772,7 @@ var api; return v; } } - error('unknkown value ' + v + ' for named ints ' + t.Name); + error('unknown value ' + v + ' for named ints ' + t.Name); } else { throw new Error('unexpected named type ' + nt);