Repository navigation
va: Match CAA parameter tags case insensitively - #8975
hablutzel1 wants to merge 1 commit into
Conversation
RFC 8659 Section 4.1 makes matching of CAA Property Tags case insensitive, but neither RFC 8659 nor RFC 8657 specifies a comparison rule for parameter tags such as "accounturi" and "validationmethods" (the grammar only constrains the allowed characters). Lowercase these parameter tags before matching, so a differently-cased tag still restricts issuance instead of being treated as an unrecognized parameter. For both parameters, ignoring a differently-cased tag drops a restriction the subscriber intended and produces a false-positive validation. For example, an unrecognized "AccountURI" tag would make the Property match any account, and an unrecognized "ValidationMethods" tag would permit any validation method. https://www.rfc-editor.org/rfc/rfc8659#section-4.1 https://www.rfc-editor.org/rfc/rfc8659#section-4.2 https://www.rfc-editor.org/rfc/rfc8657#section-3 https://www.rfc-editor.org/rfc/rfc8657#section-4
aarongable
left a comment
There was a problem hiding this comment.
We have discussed this in the past, and would prefer not to merge this change.
Yes, there is some value in the "be strict in what you produce, and liberal in what you accept" philosophy. This PR would align with being liberal in what we accept.
However, we have seen no evidence that such mis-cased labels exist in the wild. As such, we are in a position to keep it that way. Becoming more liberal in what we accept will only allow the set of all CAA records to become messier. There's no reason to allow that when the current status quo is that CAA records have the correct capitalization.
If we're going to do anything differently, we would prefer to loudly fail on CAA records containing incorrectly capitalized parameter tags.
I agree with this approach as well. Would you accept such a change? I can maybe re-purpose the current PR. |
Just to clarify, you meant failing with details when the overall CAA check has already failed, no? As there might be other valid Properties in the same RRset that could still allow issuance. On the other hand, note there is a contradiction around Line 81 in 6d0e74d Where that comment states something that isn't strictly correct according to that RFC, since RFC 8659 defines case-insensitive matching for Property Tags and not for the parameter tags carried inside an issue-value. Anyway, for Persistent DCV, parameter tag matching is case-insensitive in Boulder now. Unless those records are rejected it is the safer bet there too, otherwise it could possibly be quite easy for users to provide "persistuntil" instead of "persistUntil" and get that parameter protection ignored. My opinion here is that it would be a good idea to introduce a consistent behavior across CAA and Persistent DCV, maybe by reusing a single piece of code to process the RFC 8659 |
`parseCAARecord`'s character check rejects hyphens in a parameter tag, which matches the narrower RFC 6844 grammar rather than the RFC 8659 one it should follow. From https://www.rfc-editor.org/rfc/rfc6844#section-5.2: ``` tag = 1*(ALPHA / DIGIT) ``` From https://www.rfc-editor.org/rfc/rfc8659#section-4.2: ``` tag = (ALPHA / DIGIT) *( *("-") (ALPHA / DIGIT)) ``` The character check excludes 0x2D, so an extra hyphenated tag makes the whole record fail to parse and the caller skips it. If that was the record authorizing the CA, a request the CAA records actually authorize is denied. This simply can block a Subscriber from getting a certificate. The same check is also too lenient in the other direction: it accepts an empty tag, because the character loop runs zero times over an empty string. An empty tag is an RFC violation, since RFC 8659 `tag` requires at least one character. This last one is especially problematic and could have produced misissuances (didn't test myself to avoid the hassle of a Bugzilla Bug), because the TBRs require RFC 8659 adherence and RFC 8659 Section 4.2 says: > An issue Property Tag where the issue-value does not match the ABNF grammar MUST be treated the same as one specifying an empty issuer-domain-name. An empty issuer-domain-name authorizes no issuer, so whether a value is judged to match the grammar decides whether issuance is allowed. Validating the tag with a regexp for the RFC 8659 grammar corrects both of the previous issues: interior hyphens are accepted, and leading hyphens, trailing hyphens, and empty tags are rejected. For consistency the parameter value is validated with a regexp too. That part is separable and can be left out. On performance, a regexp is slower than the hand-rolled loops, but I think that is not significant here, since CAA checking is dominated by the DNS lookups. For the tag, a loop matching the RFC 8659 grammar is also not very concise. Finally, as mentioned earlier in #8975 (comment), it might be a good idea to implement this parsing logic in a single place and share it with the Persistent DCV method.
This makes the
accounturiandvalidationmethodsCAA parameter tags match case insensitively, so a differently cased tag such asAccountURIorValidationMethodsstill restricts issuance instead of being treated as an unrecognized parameter.From https://www.rfc-editor.org/rfc/rfc8659#section-4.1, stated for Property Tags:
That rule covers Property Tags (
issue,issuewild, and so on). For the parameter tags carried inside anissuevalue, neither RFC 8659 nor RFC 8657 defines a comparison rule.caaAccountURIMatchesandcaaValidationMethodMatchescurrently compare the parameter tag with==against the lowercase literals"accounturi"and"validationmethods". A differently cased tag does not match, so it is treated as an unrecognized parameter and the restriction is dropped. Foraccounturithe Property then matches any account, and forvalidationmethodsany validation method is accepted, so in both cases a domain that intended to restrict issuance gets a false positive validation.For reference, the same case being discussed in the PR for RFC 8657 support in the Open MPIC project, open-mpic/open-mpic-core-python#71 (comment)