Address double json-unmarshal in note (#25454)

#24390

Add a comment to provide context on why it's done this way, and a
suggestion to revisit it once the new `json/v2` is released
This commit is contained in:
Dante Catalfamo 2025-01-16 10:08:52 -05:00 committed by GitHub
parent 51fecdd91e
commit d3ea62a8ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2226,6 +2226,10 @@ func submitLogsEndpoint(ctx context.Context, request interface{}, svc fleet.Serv
}
case "result":
// NOTE(dantecatalfamo) We partially unmarshal the data here because osquery can send data we don't
// support unmarshaling, like differential query results. We also pass the raw data to logging
// facilities further down. Results are unmarshaled one at a time inside of SubmitResultLogs.
// We should re-address this once json/v2 releases and we can speed up parsing times.
var results []json.RawMessage
// NOTE(lucas): This unmarshal error is not being sent back to osquery (`if err :=` vs. `if err =`)
// Maybe there's a reason for it, we need to test such a change before fixing what appears