VA: CAA tag identifiers are case insensitive. (#3722) (#3723)
Per RFC 6844 Section 5.1 the matching of CAA tag identifiers (e.g.
"Issue") is case insensitive. This commit updates the CAA tag processing
to be case insensitive as required by the RFC.
To exercise the fix this commit adds a test case to the `caaMockDNS`
`LookupCAA` implementation for a hostname (`mixedcase.com`) that has
a CAA record with a mixed case `Issue` tag. Prior to the fix from this
branch being included in `va/caa.go` the test fails:
```
--- FAIL: TestCAAChecking/Bad_(Reserved,_Mixed_case_Issue) (0.00s)
caa_test.go:292: checkCAARecords validity mismatch for
mixedcase.com: got true expected false
```
With the fix applied, the test passes.
diff --git a/va/caa.go b/va/caa.go
index 71f260a..0b605f7 100644
--- a/va/caa.go
+++ b/va/caa.go
@@ -84,7 +84,7 @@
var filtered CAASet
for _, caaRecord := range CAAs {
- switch caaRecord.Tag {
+ switch strings.ToLower(caaRecord.Tag) {
case "issue":
filtered.Issue = append(filtered.Issue, caaRecord)
case "issuewild":
diff --git a/va/caa_test.go b/va/caa_test.go
index 2391d33..f411309 100644
--- a/va/caa_test.go
+++ b/va/caa_test.go
@@ -44,6 +44,10 @@
record.Tag = "issue"
record.Value = "ca.com"
results = append(results, &record)
+ case "mixedcase.com":
+ record.Tag = "iSsUe"
+ record.Value = "ca.com"
+ results = append(results, &record)
case "critical.com":
record.Flag = 1
record.Tag = "issue"
@@ -158,6 +162,12 @@
Valid: false,
},
{
+ Name: "Bad (Reserved, Mixed case Issue)",
+ Domain: "mixedcase.com",
+ Present: true,
+ Valid: false,
+ },
+ {
Name: "Bad (Critical)",
Domain: "critical.com",
Present: true,