Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1701

JSON parser is incredibly lax

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.0
    • Component/s: None
    • Labels:
      None

      Description

      The JSON parser that ships with CFEngine is very loose with what it considers JSON. This allows users to add multiple consecutive characters, add trailing elements, and have trailing commas in lists.

      I have a patch that fixes the first of these issues here: https://github.com/cfengine/core/pull/2009

      In some cases, because of the behavior where JSON input will silently truncate, some of this data will get dropped by the JSON parser. I've only seen this so far where elements not separated by commas would get dropped by the parser, however that isn't picked up by the parser anyway, so it doesn't matter.

      All that said, I am wondering why an extant JSON library wasn't used instead. c-json, cson or jansson would take care of most of these issues.

        Attachments

          Activity

            People

            Assignee:
            a10040 Kristian Amlie
            Reporter:
            worr William Orr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: