cloudquery/plugin-sdk

Destination plugins receive escaped data

candiduslynx opened this issue · 2 comments

Describe the bug

JSON fields (and possibly others) receive escaped data, as was seen in cloudquery/cloudquery#7001.
The reason for this is that source plugins use json.Marshal that does escaping, but the destination plugins can't perform unmarshaling due to lack of original structure.
So, the data received has unicode characters escaped, and it might be written to the destination in the same way.

Expected Behavior

All values received by destination plugins should be unescaped.

Steps to Reproduce

  1. Create a tagged resource in Azure with key MyKey and value A&B.
  2. Run the destination plugin in debugger
  3. See that the value is received as {"MyKey":"A\u0026B"}, while it should've been presented as {"MyKey":"A&B"}

Possible Solution

Add preliminary unescape for the data in the destination.

Provider and CloudQuery version

latest

Additional Context

No response

I suggest adding the Unicode characters to the generated input in the plugin testing for every applicable type.
This way we'll be able to see the data types that require unescaping.