Skip to content

Commit

Permalink
update to latest sherpats fixing typo in error message, handle absent…
Browse files Browse the repository at this point in the history
… dmarc "policy override" reason
  • Loading branch information
mjl- committed Mar 9, 2024
1 parent a964939 commit 0c800f3
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 25 deletions.
2 changes: 2 additions & 0 deletions dmarcrpt/feedback.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ type PolicyOverrideReason struct {
type PolicyOverride string

const (
PolicyOverrideAbsent PolicyOverride = ""

PolicyOverrideForwarded PolicyOverride = "forwarded"
PolicyOverrideSampledOut PolicyOverride = "sampled_out"
PolicyOverrideTrustedForwarder PolicyOverride = "trusted_forwarder"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions vendor/github.com/mjl-/sherpats/ts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions webaccount/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions webaccount/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)
}
Expand Down
7 changes: 4 additions & 3 deletions webadmin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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": "" }] },
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion webadmin/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('; ')),
)
),
),
Expand Down
5 changes: 5 additions & 0 deletions webadmin/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions webadmin/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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":""}]},
Expand Down Expand Up @@ -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)) {
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions webmail/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions webmail/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions webmail/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions webmail/webmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 0c800f3

Please sign in to comment.