Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #25188

Closed (moved)
(moved)
Open
Created Feb 09, 2018 by Trac@tracbot

Spec bug in formal definition of Document in dir-spec.txt

I was attempting to write a parser that reads vote/consensus documents using the the formal definition here. However, I noticed an ambiguity.

Using only the formal definition, the following:

directory-signature 13241234321 12343234
-----BEGIN SIGNATURE-----
00thisisvalidbase64data12345
-----END SIGNATURE-----

Could be potentially parsed as

Document(
  Item(
    KeywordLine(
      Keyword(KeywordChar+("directory-signature")),
      WS,
      ArgumentChar+("13241234321 12343234"),
      NL
    )
  ),
  Item(
    KeywordLine(
      Keyword(KeywordChar+("-----BEGIN")),
      WS,
      ArgumentChar+("SIGNATURE-----"),
      NL
    )
  ),
  Item(
    KeywordLine(
      Keyword(KeywordChar+("00thisisvalidbase64data12345"))
      WS,
      ArgumentChar+("SIGNATURE-----"),
      NL
    )
  ),
  Item(
    KeywordLine(
      Keyword(KeywordChar+("-----END")),
      WS,
      ArgumentChar+("SIGNATURE-----"),
      NL
    )
  ),
)

When the correct parsing would be

Document(
  Item(
    KeywordLine(
      Keyword(KeywordChar+("directory-signature")),
      WS,
      ArgumentChar+("13241234321 12343234"),
      NL
    ),
    Object(
      BeginLine(
        "-----BEGIN ",
        Keyword(KeywordChar+("SIGNATURE")),
        "-----",
        NL
      ),
      Base64-encoded-data("00thisisvalidbase64data12345"),
      EndLine(
        "-----END ",
        Keyword(KeywordChar+("SIGNATURE")),
        "-----",
        NL
      ),
    ),
  ),
)

A potential change to the spec (assuming that keywords will never start with "-") that would prevent would be to replace

Keyword = KeywordChar+
KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'

with

Keyword = KeywordStartChar KeywordChar*
KeywordStartChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9'
KeywordChar ::= 'A' ... 'Z' | 'a' ... 'z' | '0' ... '9' | '-'

Trac:
Username: witchof0x20

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking