Skip to content

Duplicate keys, a source of security vulnerabilities,are accepted by Yojson #161

Open
@mbacarella

Description

I know some work was done on JSON compliance here #34 but could we consider taking a stronger position?

I would expect duplicate keys to raise but instead yojson silently accepts them. This can lead to inconsistent rules enforcement behavior, especially when passing messages between systems with different JSON implementations.

let j = Yojson.Safe.from_string "{ \"qty\":1, \"qty\":-1 }" ;;
val j : Yojson.Safe.t = `Assoc [("qty", `Int 1); ("qty", `Int (-1))]

An exposition is here An Exploration of JSON Interoperability Vulnerabilities

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions