Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABNF: allow lines at the end of the file #174

Closed
joker314 opened this issue Dec 11, 2019 · 2 comments
Closed

ABNF: allow lines at the end of the file #174

joker314 opened this issue Dec 11, 2019 · 2 comments

Comments

@joker314
Copy link
Contributor

joker314 commented Dec 11, 2019

The current ABNF reads:

   unsigned         =  *line [can-field eol]
                       *line (contact-field eol)
                       *line [lang-field eol] *line
                       ; the order of elements is not important

This last comment (after the ;) appears to indicate that the ABNF lines can be reordered, but the entities within the lines probably cannot.

NB: If I have misunderstood, and literally everything in the ABNF above can be reordered as much as you like (that is, the ABNF has different lines not for semantic reasons but just because it was too long to fit on one line etc.), then this doesn't apply. In this case, there may be ambiguity in terms of the order within the parentheses (e.g. is eol contact-field allowed? it shouldn't be because it can lead to files which should be invalid). I'm not sure.

Observe that the Preferred-Languages directive (lang-field) has a different ABNF to all of the others. This is so that you can have lines after all of these special fields have been dealt with. The problem is that the Preferred-Languages directive isn't special anymore because it might not appear at the end. If it appears at the start for example, then the security.txt file will become non-compliant if there are comments or other fields at the end of the file.

Preferred-Languages: ... # allows for `line`s after it
Contact: ...
Canonical: ... # this is not allowed because `contact-field` doesn't allow lines after it

To solve this, I would suggest creating some sort of intermediary non-terminal, and then having unsigned force *line to be after it:

   unsigned-intermediate =   *line [can-field eol]
                             *line (contact-field eol)
                             *line [lang-field eol] *line
                             ; the order of elements is not important

   unsigned = unsigned-intermediate *line

I would also suggest placing parentheses around each line to make it clear that they should be treated as separate units when it comes to "the order of elements is not important"

@nightwatchcyber
Copy link
Contributor

Please review the -09 draft to see if this still applies

@joker314
Copy link
Contributor Author

The -09 draft indeed resolved this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants