np5
08/02/2023, 10:03 AMseph
seph
seph
managed_policies
table is assuming data is a simple key:value form, but in reality the data may be more complex. So you’re proposing bringing in some data flattening to make something closer to an EAV table.seph
seph
seph
/
instead of .
as the separator. That makes sense to me.np5
09/12/2023, 6:08 PMnp5
09/12/2023, 6:08 PMnp5
09/12/2023, 6:08 PMnp5
09/12/2023, 6:09 PMseph
key
feels wrong to me. I’d probably use fullkey
. Looking at plist
I don’t see a great example. Hrm, If I look further, I think your example is amissnp5
09/12/2023, 6:10 PMseph
seph
<dict>
[…]
<key>PayloadType</key>
<string>com.apple.system-extension-policy</string>
<key>AllowUserOverrides</key>
<true/>
<key>AllowedSystemExtensions</key>
<dict>
<key>EQHXZ8M8AV</key>
<array>
<string>com.google.santa.daemon</string>
</array>
</dict>
<key>AllowedSystemExtensionTypes</key>
<dict>
<key>EQHXZ8M8AV</key>
<array>
<string>EndpointSecurityExtension</string>
</array>
</dict>
</dict>
I’d expect raw data to be something like:
[
{fullkey: AllowUserOverrides, value: 1 },
{fullkey: AllowedSystemExtensionTypes/EQHXZ8M8AV/0, value: EndpointSecurityExtension}
{fullkey: AllowedSystemExtensions/EQHXZ8M8AV/0, value: com.google.santa.daemon}
]
And then there’s this mess because the existing name
is really “top key”, which always feels weird and backwards to me. So I’m not sure subkey is great — my experience with the plist table is that it just doesn’t flatten correctly.np5
09/12/2023, 6:17 PMseph
name
as the top key for compatibility, and then add fullkey
, parent
, and key
. And kinda expect that people will either use the new columns, or the old legacy oneseph
kolide_xml
. The resultant table is:
+--------------------------+-------------------+--------+-----------------------------------+-------+------------+
| fullkey | parent | key | value | query | path |
+--------------------------+-------------------+--------+-----------------------------------+-------+------------+
| dict/key/0 | dict/key | 0 | PayloadType | * | /tmp/e.xml |
| dict/key/1 | dict/key | 1 | AllowUserOverrides | * | /tmp/e.xml |
| dict/key/2 | dict/key | 2 | AllowedSystemExtensions | * | /tmp/e.xml |
| dict/key/3 | dict/key | 3 | AllowedSystemExtensionTypes | * | /tmp/e.xml |
| dict/string | dict | string | com.apple.system-extension-policy | * | /tmp/e.xml |
| dict/true | dict | true | | * | /tmp/e.xml |
| dict/dict/0/key | dict/dict/0 | key | EQHXZ8M8AV | * | /tmp/e.xml |
| dict/dict/0/array/string | dict/dict/0/array | string | com.google.santa.daemon | * | /tmp/e.xml |
| dict/dict/1/array/string | dict/dict/1/array | string | EndpointSecurityExtension | * | /tmp/e.xml |
| dict/dict/1/key | dict/dict/1 | key | EQHXZ8M8AV | * | /tmp/e.xml |
+--------------------------+-------------------+--------+-----------------------------------+-------+------------+
(Because it’s xml, the dict shows up a bunch)seph
+-----------------------------------+--------------------------------------+-----------------------------+------------------------------------------+----------------------------------------+--------------------+---------------------------+
| domain | uuid | name | fullkey | parentkey | key | value |
+-----------------------------------+--------------------------------------+-----------------------------+------------------------------------------+----------------------------------------+--------------------+---------------------------+
| com.apple.system-extension-policy | 00000000-0000-0000-0000-000000000000 | AllowUserOverrides | AllowUserOverrides | | AllowUserOverrides | 1 |
| com.apple.system-extension-policy | 00000000-0000-0000-0000-000000000000 | AllowedSystemExtensions | AllowedSystemExtensions/EQHXZ8M8AV/0 | AllowedSystemExtensions/EQHXZ8M8AV | 0 | com.google.santa.daemon |
| com.apple.system-extension-policy | 00000000-0000-0000-0000-000000000000 | AllowedSystemExtensionTypes | AllowedSystemExtensionTypes/EQHXZ8M8AV/0 | AllowedSystemExtensionTypes/EQHXZ8M8AV | 0 | EndpointSecurityExtension |
+-----------------------------------+--------------------------------------+-----------------------------+------------------------------------------+----------------------------------------+--------------------+---------------------------+
np5
09/12/2023, 6:24 PMseph
seph
com.google.santa.daemon
as a string value in an array, and not as a key name with a 1
valuenp5
09/12/2023, 6:28 PMnp5
09/12/2023, 6:28 PMseph
seph
path
since that often referes to path on disk.np5
09/12/2023, 6:29 PMseph
fullkey
is the same path
in a sense.
parent
and key
are useful as shortcuts. It’s nicer to say select 1 where value = 'com.google.santa.daemon' and parentkey = 'AllowedSystemExtensions/EQHXZ8M8AV'
than to split or string match on fullkeynp5
09/12/2023, 6:36 PMnp5
09/12/2023, 6:37 PMseph
np5
09/12/2023, 6:40 PMnp5
09/12/2023, 6:40 PMseph