microsoft / onefuzz

A self-hosted Fuzzing-As-A-Service platform
MIT License
2.82k stars 198 forks source link

Add a new test for `report.extension_data` #3481

Open DrChat opened 1 year ago

DrChat commented 1 year ago

Summary of the Pull Request

Adds a new (failing) test for using report.extension_data in a notification template.

PR Checklist

DrChat commented 1 year ago

Looks like this is going to be a massive PITA to fix. Basically, Scriban doesn't support JsonElement in any capacity for their little ScriptObject helper. So we can't pass JsonElement in any capacity to them. Additionally, ScriptObject.Import supports filtering and renaming fields, but not converting them :\

It looks like Newtonsoft.Json may be a better choice for deserializing JSON, as they have full support for converting JSON to arbitrary C# objects (dynamic) instead of just JsonElement (reference)

I've also found this solution for using System.Text.Json to convert arbitrary JSON to a tree of dynamic objects: https://dotnetfiddle.net/1Y6hI6

See here for more context: https://github.com/scriban/scriban/issues/148