Skip to content

Consider returning an error on duplicate keys by default #762

@vks

Description

@vks

Parsing duplicate JSON keys (as in {"qty": 1, "qty": -1}) can be dangerous if the parsing behavior is inconsistent. (See here for a detailed discussion.) Some parsers will give for {"qty": 1, "qty": -1} the same result as for {"qty": -1} (i.e. serde_json's current behavior), others will give the same result as for {"qty": 1}. For some applications, this inconsistency may be exploited by attackers.

Therefore, it may be more prudent for serde_json to return an error for duplicate keys by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions