Skip to content

JSON body parsing issue with environment variable replacement  #9

@matprov

Description

@matprov

When we send a JSON body containing a serialized JSON object as a property value, format_object() causes two issues.

Sample json:

{
  "inputs": [
    {
      "data": "{\"features\": [{\"geometry\": {\"type\": \"Polygon\", \"coordinates\": []}}]}"
    }
]

First issue is related to .replace('{{', '{').replace('}}', '}') that replaced the "}}" with "}", which errors the parsing.

Second issue is the parsing that will be chosen in this case will be the one defined by isinstance(o, str) since it's a string, therefore not parsing the body properly, and will try to replace parts of the string with non-existing environment variables.

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