Skip to content

Failure to parse escaped double-quotes inside SD values #12

@ChezBunch

Description

@ChezBunch

Consider the following code :

const parser = require("nsyslog-parser");
console.log(parser('<15>1 2021-05-06T08:02:30.282938Z host APP 1000 l [c q="x"]').structuredData);
console.log(parser('<15>1 2021-05-06T08:02:30.282938Z host APP 1000 l [c q="\\""]').structuredData);

It generates the following output:

[ { '$id': 'c@0', q: 'x' } ]
[]

Where it should be generating this:

[ { '$id': 'c@0', q: 'x' } ]
[ { '$id': 'c@0', q: '"' } ]

The RFC5424 states that :
Inside PARAM-VALUE, the characters '"' (ABNF %d34), '\' (ABNF %d92), and ']' (ABNF %d93) MUST be escaped.

Nevertheless, the parsing does not seem to properly parse escaped double-quotes inside SD values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions