ocsf-schema icon indicating copy to clipboard operation
ocsf-schema copied to clipboard

Confusion about json_t

Open rmouritzen-splunk opened this issue 1 year ago • 4 comments

The json_t type has ended up with two interpretations:

Options

Option 1: json_t is the any type

  • The json_t is an any type, meaning any valid JSON type can be placed here.
  • When OCSF events are expressed as JSON, attributes of this value are the any valid JSON type.
  • When OCSF events are expressed in serialization formats like Protobuf, a variant type would need to be defined and used, or the valid would need to be expressed in JSON. Either way, this is somewhat complicated.

Option 2: json_t is a string containing JSON

  • The json_t is a string that is a JSON encoding of any valid JSON.
  • When OCSF events are expressed as JSON, attributes of this type are double encoded.
  • When OCSF events are expressed in serialization formats like Protobuf, attributes of this type are a string containing JSON.

Note

The original intent was json_t is an any type. However actually usage has ended up split between the two interpretations above. Changing to either interpretation will cause pain for some members of the community, so both interpretations should be up for consideration going forward.

rmouritzen-splunk avatar Jan 30 '24 18:01 rmouritzen-splunk

Just for context, after long discussion we are encoding json_t to google.protobuf.Struct in SentinelOne Technically it does not cover "primitive" JSON values (like a single number in the root) but it seemed to be a lesser evil. In other words, we defined json_t as any JSON object.

lukas-krecan-s1 avatar Jan 31 '24 08:01 lukas-krecan-s1

Defining json_t as a JSON object actually wouldn't work for at least one of Splunk's internal use-cases. We have a field that ends up as a string in one case and an object in another. (These are both from Windows Event Logs. The first case comes from XML events, while the other comes from the older multiline events.)

rmouritzen-splunk avatar Feb 05 '24 23:02 rmouritzen-splunk

Marked with the "v2.0 and later" tag since there's not much that can be done to the 1.x schema to fix this.

rmouritzen-splunk avatar Dec 05 '24 20:12 rmouritzen-splunk

For the 1.x schemas, we'll clarify the description with the original "any type" intent.

rmouritzen-splunk avatar Feb 11 '25 18:02 rmouritzen-splunk