endpoint_security 0.1.0-universal-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +44 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +114 -0
  5. data/Rakefile +170 -0
  6. data/codegen/ast.rb +67 -0
  7. data/codegen/emit_c.rb +68 -0
  8. data/codegen/emit_ruby.rb +128 -0
  9. data/codegen/ir.rb +193 -0
  10. data/codegen/overlay/availability.yml +158 -0
  11. data/codegen/overlay/version_map.yml +92 -0
  12. data/codegen/run.rb +80 -0
  13. data/codegen/snapshots/26.5.json +5828 -0
  14. data/examples/eslogger_clone.rb +5 -0
  15. data/examples/execblock.rb +16 -0
  16. data/examples/filemon.rb +10 -0
  17. data/examples/procmon.rb +13 -0
  18. data/ext/endpoint_security/client.c +795 -0
  19. data/ext/endpoint_security/client.h +88 -0
  20. data/ext/endpoint_security/endpoint_security.c +17 -0
  21. data/ext/endpoint_security/extconf.rb +37 -0
  22. data/ext/endpoint_security/field.c +719 -0
  23. data/ext/endpoint_security/field.h +42 -0
  24. data/ext/endpoint_security/generated/es_schema.c +1233 -0
  25. data/ext/endpoint_security/message.c +426 -0
  26. data/ext/endpoint_security/message.h +13 -0
  27. data/ext/endpoint_security/mute.c +291 -0
  28. data/ext/endpoint_security/mute.h +8 -0
  29. data/ext/endpoint_security/queue.c +124 -0
  30. data/ext/endpoint_security/queue.h +46 -0
  31. data/ext/endpoint_security/watchdog.c +243 -0
  32. data/lib/endpoint_security/availability.rb +30 -0
  33. data/lib/endpoint_security/client.rb +280 -0
  34. data/lib/endpoint_security/diagnostics.rb +26 -0
  35. data/lib/endpoint_security/doctor.rb +35 -0
  36. data/lib/endpoint_security/errors.rb +42 -0
  37. data/lib/endpoint_security/generated/availability.rb +169 -0
  38. data/lib/endpoint_security/generated/enums.rb +409 -0
  39. data/lib/endpoint_security/generated/event_types.rb +520 -0
  40. data/lib/endpoint_security/message.rb +29 -0
  41. data/lib/endpoint_security/object_model.rb +170 -0
  42. data/lib/endpoint_security/recorder.rb +26 -0
  43. data/lib/endpoint_security/version.rb +6 -0
  44. data/lib/endpoint_security.rb +38 -0
  45. data/support/entitlements.plist +8 -0
  46. data/support/esmock/esmock.c +482 -0
  47. data/support/esmock/esmock.h +21 -0
  48. data/support/sign_ruby.sh +13 -0
  49. metadata +90 -0
@@ -0,0 +1,520 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by codegen/run.rb. Do not edit.
4
+
5
+ module EndpointSecurity
6
+ # Event names and numeric values from the build SDK.
7
+ module EventType
8
+ # The +auth_exec+ event.
9
+ AUTH_EXEC = :auth_exec
10
+ # The +auth_open+ event.
11
+ AUTH_OPEN = :auth_open
12
+ # The +auth_kextload+ event.
13
+ AUTH_KEXTLOAD = :auth_kextload
14
+ # The +auth_mmap+ event.
15
+ AUTH_MMAP = :auth_mmap
16
+ # The +auth_mprotect+ event.
17
+ AUTH_MPROTECT = :auth_mprotect
18
+ # The +auth_mount+ event.
19
+ AUTH_MOUNT = :auth_mount
20
+ # The +auth_rename+ event.
21
+ AUTH_RENAME = :auth_rename
22
+ # The +auth_signal+ event.
23
+ AUTH_SIGNAL = :auth_signal
24
+ # The +auth_unlink+ event.
25
+ AUTH_UNLINK = :auth_unlink
26
+ # The +notify_exec+ event.
27
+ NOTIFY_EXEC = :notify_exec
28
+ # The +notify_open+ event.
29
+ NOTIFY_OPEN = :notify_open
30
+ # The +notify_fork+ event.
31
+ NOTIFY_FORK = :notify_fork
32
+ # The +notify_close+ event.
33
+ NOTIFY_CLOSE = :notify_close
34
+ # The +notify_create+ event.
35
+ NOTIFY_CREATE = :notify_create
36
+ # The +notify_exchangedata+ event.
37
+ NOTIFY_EXCHANGEDATA = :notify_exchangedata
38
+ # The +notify_exit+ event.
39
+ NOTIFY_EXIT = :notify_exit
40
+ # The +notify_get_task+ event.
41
+ NOTIFY_GET_TASK = :notify_get_task
42
+ # The +notify_kextload+ event.
43
+ NOTIFY_KEXTLOAD = :notify_kextload
44
+ # The +notify_kextunload+ event.
45
+ NOTIFY_KEXTUNLOAD = :notify_kextunload
46
+ # The +notify_link+ event.
47
+ NOTIFY_LINK = :notify_link
48
+ # The +notify_mmap+ event.
49
+ NOTIFY_MMAP = :notify_mmap
50
+ # The +notify_mprotect+ event.
51
+ NOTIFY_MPROTECT = :notify_mprotect
52
+ # The +notify_mount+ event.
53
+ NOTIFY_MOUNT = :notify_mount
54
+ # The +notify_unmount+ event.
55
+ NOTIFY_UNMOUNT = :notify_unmount
56
+ # The +notify_iokit_open+ event.
57
+ NOTIFY_IOKIT_OPEN = :notify_iokit_open
58
+ # The +notify_rename+ event.
59
+ NOTIFY_RENAME = :notify_rename
60
+ # The +notify_setattrlist+ event.
61
+ NOTIFY_SETATTRLIST = :notify_setattrlist
62
+ # The +notify_setextattr+ event.
63
+ NOTIFY_SETEXTATTR = :notify_setextattr
64
+ # The +notify_setflags+ event.
65
+ NOTIFY_SETFLAGS = :notify_setflags
66
+ # The +notify_setmode+ event.
67
+ NOTIFY_SETMODE = :notify_setmode
68
+ # The +notify_setowner+ event.
69
+ NOTIFY_SETOWNER = :notify_setowner
70
+ # The +notify_signal+ event.
71
+ NOTIFY_SIGNAL = :notify_signal
72
+ # The +notify_unlink+ event.
73
+ NOTIFY_UNLINK = :notify_unlink
74
+ # The +notify_write+ event.
75
+ NOTIFY_WRITE = :notify_write
76
+ # The +auth_file_provider_materialize+ event.
77
+ AUTH_FILE_PROVIDER_MATERIALIZE = :auth_file_provider_materialize
78
+ # The +notify_file_provider_materialize+ event.
79
+ NOTIFY_FILE_PROVIDER_MATERIALIZE = :notify_file_provider_materialize
80
+ # The +auth_file_provider_update+ event.
81
+ AUTH_FILE_PROVIDER_UPDATE = :auth_file_provider_update
82
+ # The +notify_file_provider_update+ event.
83
+ NOTIFY_FILE_PROVIDER_UPDATE = :notify_file_provider_update
84
+ # The +auth_readlink+ event.
85
+ AUTH_READLINK = :auth_readlink
86
+ # The +notify_readlink+ event.
87
+ NOTIFY_READLINK = :notify_readlink
88
+ # The +auth_truncate+ event.
89
+ AUTH_TRUNCATE = :auth_truncate
90
+ # The +notify_truncate+ event.
91
+ NOTIFY_TRUNCATE = :notify_truncate
92
+ # The +auth_link+ event.
93
+ AUTH_LINK = :auth_link
94
+ # The +notify_lookup+ event.
95
+ NOTIFY_LOOKUP = :notify_lookup
96
+ # The +auth_create+ event.
97
+ AUTH_CREATE = :auth_create
98
+ # The +auth_setattrlist+ event.
99
+ AUTH_SETATTRLIST = :auth_setattrlist
100
+ # The +auth_setextattr+ event.
101
+ AUTH_SETEXTATTR = :auth_setextattr
102
+ # The +auth_setflags+ event.
103
+ AUTH_SETFLAGS = :auth_setflags
104
+ # The +auth_setmode+ event.
105
+ AUTH_SETMODE = :auth_setmode
106
+ # The +auth_setowner+ event.
107
+ AUTH_SETOWNER = :auth_setowner
108
+ # The +auth_chdir+ event.
109
+ AUTH_CHDIR = :auth_chdir
110
+ # The +notify_chdir+ event.
111
+ NOTIFY_CHDIR = :notify_chdir
112
+ # The +auth_getattrlist+ event.
113
+ AUTH_GETATTRLIST = :auth_getattrlist
114
+ # The +notify_getattrlist+ event.
115
+ NOTIFY_GETATTRLIST = :notify_getattrlist
116
+ # The +notify_stat+ event.
117
+ NOTIFY_STAT = :notify_stat
118
+ # The +notify_access+ event.
119
+ NOTIFY_ACCESS = :notify_access
120
+ # The +auth_chroot+ event.
121
+ AUTH_CHROOT = :auth_chroot
122
+ # The +notify_chroot+ event.
123
+ NOTIFY_CHROOT = :notify_chroot
124
+ # The +auth_utimes+ event.
125
+ AUTH_UTIMES = :auth_utimes
126
+ # The +notify_utimes+ event.
127
+ NOTIFY_UTIMES = :notify_utimes
128
+ # The +auth_clone+ event.
129
+ AUTH_CLONE = :auth_clone
130
+ # The +notify_clone+ event.
131
+ NOTIFY_CLONE = :notify_clone
132
+ # The +notify_fcntl+ event.
133
+ NOTIFY_FCNTL = :notify_fcntl
134
+ # The +auth_getextattr+ event.
135
+ AUTH_GETEXTATTR = :auth_getextattr
136
+ # The +notify_getextattr+ event.
137
+ NOTIFY_GETEXTATTR = :notify_getextattr
138
+ # The +auth_listextattr+ event.
139
+ AUTH_LISTEXTATTR = :auth_listextattr
140
+ # The +notify_listextattr+ event.
141
+ NOTIFY_LISTEXTATTR = :notify_listextattr
142
+ # The +auth_readdir+ event.
143
+ AUTH_READDIR = :auth_readdir
144
+ # The +notify_readdir+ event.
145
+ NOTIFY_READDIR = :notify_readdir
146
+ # The +auth_deleteextattr+ event.
147
+ AUTH_DELETEEXTATTR = :auth_deleteextattr
148
+ # The +notify_deleteextattr+ event.
149
+ NOTIFY_DELETEEXTATTR = :notify_deleteextattr
150
+ # The +auth_fsgetpath+ event.
151
+ AUTH_FSGETPATH = :auth_fsgetpath
152
+ # The +notify_fsgetpath+ event.
153
+ NOTIFY_FSGETPATH = :notify_fsgetpath
154
+ # The +notify_dup+ event.
155
+ NOTIFY_DUP = :notify_dup
156
+ # The +auth_settime+ event.
157
+ AUTH_SETTIME = :auth_settime
158
+ # The +notify_settime+ event.
159
+ NOTIFY_SETTIME = :notify_settime
160
+ # The +notify_uipc_bind+ event.
161
+ NOTIFY_UIPC_BIND = :notify_uipc_bind
162
+ # The +auth_uipc_bind+ event.
163
+ AUTH_UIPC_BIND = :auth_uipc_bind
164
+ # The +notify_uipc_connect+ event.
165
+ NOTIFY_UIPC_CONNECT = :notify_uipc_connect
166
+ # The +auth_uipc_connect+ event.
167
+ AUTH_UIPC_CONNECT = :auth_uipc_connect
168
+ # The +auth_exchangedata+ event.
169
+ AUTH_EXCHANGEDATA = :auth_exchangedata
170
+ # The +auth_setacl+ event.
171
+ AUTH_SETACL = :auth_setacl
172
+ # The +notify_setacl+ event.
173
+ NOTIFY_SETACL = :notify_setacl
174
+ # The +notify_pty_grant+ event.
175
+ NOTIFY_PTY_GRANT = :notify_pty_grant
176
+ # The +notify_pty_close+ event.
177
+ NOTIFY_PTY_CLOSE = :notify_pty_close
178
+ # The +auth_proc_check+ event.
179
+ AUTH_PROC_CHECK = :auth_proc_check
180
+ # The +notify_proc_check+ event.
181
+ NOTIFY_PROC_CHECK = :notify_proc_check
182
+ # The +auth_get_task+ event.
183
+ AUTH_GET_TASK = :auth_get_task
184
+ # The +auth_searchfs+ event.
185
+ AUTH_SEARCHFS = :auth_searchfs
186
+ # The +notify_searchfs+ event.
187
+ NOTIFY_SEARCHFS = :notify_searchfs
188
+ # The +auth_fcntl+ event.
189
+ AUTH_FCNTL = :auth_fcntl
190
+ # The +auth_iokit_open+ event.
191
+ AUTH_IOKIT_OPEN = :auth_iokit_open
192
+ # The +auth_proc_suspend_resume+ event.
193
+ AUTH_PROC_SUSPEND_RESUME = :auth_proc_suspend_resume
194
+ # The +notify_proc_suspend_resume+ event.
195
+ NOTIFY_PROC_SUSPEND_RESUME = :notify_proc_suspend_resume
196
+ # The +notify_cs_invalidated+ event.
197
+ NOTIFY_CS_INVALIDATED = :notify_cs_invalidated
198
+ # The +notify_get_task_name+ event.
199
+ NOTIFY_GET_TASK_NAME = :notify_get_task_name
200
+ # The +notify_trace+ event.
201
+ NOTIFY_TRACE = :notify_trace
202
+ # The +notify_remote_thread_create+ event.
203
+ NOTIFY_REMOTE_THREAD_CREATE = :notify_remote_thread_create
204
+ # The +auth_remount+ event.
205
+ AUTH_REMOUNT = :auth_remount
206
+ # The +notify_remount+ event.
207
+ NOTIFY_REMOUNT = :notify_remount
208
+ # The +auth_get_task_read+ event.
209
+ AUTH_GET_TASK_READ = :auth_get_task_read
210
+ # The +notify_get_task_read+ event.
211
+ NOTIFY_GET_TASK_READ = :notify_get_task_read
212
+ # The +notify_get_task_inspect+ event.
213
+ NOTIFY_GET_TASK_INSPECT = :notify_get_task_inspect
214
+ # The +notify_setuid+ event.
215
+ NOTIFY_SETUID = :notify_setuid
216
+ # The +notify_setgid+ event.
217
+ NOTIFY_SETGID = :notify_setgid
218
+ # The +notify_seteuid+ event.
219
+ NOTIFY_SETEUID = :notify_seteuid
220
+ # The +notify_setegid+ event.
221
+ NOTIFY_SETEGID = :notify_setegid
222
+ # The +notify_setreuid+ event.
223
+ NOTIFY_SETREUID = :notify_setreuid
224
+ # The +notify_setregid+ event.
225
+ NOTIFY_SETREGID = :notify_setregid
226
+ # The +auth_copyfile+ event.
227
+ AUTH_COPYFILE = :auth_copyfile
228
+ # The +notify_copyfile+ event.
229
+ NOTIFY_COPYFILE = :notify_copyfile
230
+ # The +notify_authentication+ event.
231
+ NOTIFY_AUTHENTICATION = :notify_authentication
232
+ # The +notify_xp_malware_detected+ event.
233
+ NOTIFY_XP_MALWARE_DETECTED = :notify_xp_malware_detected
234
+ # The +notify_xp_malware_remediated+ event.
235
+ NOTIFY_XP_MALWARE_REMEDIATED = :notify_xp_malware_remediated
236
+ # The +notify_lw_session_login+ event.
237
+ NOTIFY_LW_SESSION_LOGIN = :notify_lw_session_login
238
+ # The +notify_lw_session_logout+ event.
239
+ NOTIFY_LW_SESSION_LOGOUT = :notify_lw_session_logout
240
+ # The +notify_lw_session_lock+ event.
241
+ NOTIFY_LW_SESSION_LOCK = :notify_lw_session_lock
242
+ # The +notify_lw_session_unlock+ event.
243
+ NOTIFY_LW_SESSION_UNLOCK = :notify_lw_session_unlock
244
+ # The +notify_screensharing_attach+ event.
245
+ NOTIFY_SCREENSHARING_ATTACH = :notify_screensharing_attach
246
+ # The +notify_screensharing_detach+ event.
247
+ NOTIFY_SCREENSHARING_DETACH = :notify_screensharing_detach
248
+ # The +notify_openssh_login+ event.
249
+ NOTIFY_OPENSSH_LOGIN = :notify_openssh_login
250
+ # The +notify_openssh_logout+ event.
251
+ NOTIFY_OPENSSH_LOGOUT = :notify_openssh_logout
252
+ # The +notify_login_login+ event.
253
+ NOTIFY_LOGIN_LOGIN = :notify_login_login
254
+ # The +notify_login_logout+ event.
255
+ NOTIFY_LOGIN_LOGOUT = :notify_login_logout
256
+ # The +notify_btm_launch_item_add+ event.
257
+ NOTIFY_BTM_LAUNCH_ITEM_ADD = :notify_btm_launch_item_add
258
+ # The +notify_btm_launch_item_remove+ event.
259
+ NOTIFY_BTM_LAUNCH_ITEM_REMOVE = :notify_btm_launch_item_remove
260
+ # The +notify_profile_add+ event.
261
+ NOTIFY_PROFILE_ADD = :notify_profile_add
262
+ # The +notify_profile_remove+ event.
263
+ NOTIFY_PROFILE_REMOVE = :notify_profile_remove
264
+ # The +notify_su+ event.
265
+ NOTIFY_SU = :notify_su
266
+ # The +notify_authorization_petition+ event.
267
+ NOTIFY_AUTHORIZATION_PETITION = :notify_authorization_petition
268
+ # The +notify_authorization_judgement+ event.
269
+ NOTIFY_AUTHORIZATION_JUDGEMENT = :notify_authorization_judgement
270
+ # The +notify_sudo+ event.
271
+ NOTIFY_SUDO = :notify_sudo
272
+ # The +notify_od_group_add+ event.
273
+ NOTIFY_OD_GROUP_ADD = :notify_od_group_add
274
+ # The +notify_od_group_remove+ event.
275
+ NOTIFY_OD_GROUP_REMOVE = :notify_od_group_remove
276
+ # The +notify_od_group_set+ event.
277
+ NOTIFY_OD_GROUP_SET = :notify_od_group_set
278
+ # The +notify_od_modify_password+ event.
279
+ NOTIFY_OD_MODIFY_PASSWORD = :notify_od_modify_password
280
+ # The +notify_od_disable_user+ event.
281
+ NOTIFY_OD_DISABLE_USER = :notify_od_disable_user
282
+ # The +notify_od_enable_user+ event.
283
+ NOTIFY_OD_ENABLE_USER = :notify_od_enable_user
284
+ # The +notify_od_attribute_value_add+ event.
285
+ NOTIFY_OD_ATTRIBUTE_VALUE_ADD = :notify_od_attribute_value_add
286
+ # The +notify_od_attribute_value_remove+ event.
287
+ NOTIFY_OD_ATTRIBUTE_VALUE_REMOVE = :notify_od_attribute_value_remove
288
+ # The +notify_od_attribute_set+ event.
289
+ NOTIFY_OD_ATTRIBUTE_SET = :notify_od_attribute_set
290
+ # The +notify_od_create_user+ event.
291
+ NOTIFY_OD_CREATE_USER = :notify_od_create_user
292
+ # The +notify_od_create_group+ event.
293
+ NOTIFY_OD_CREATE_GROUP = :notify_od_create_group
294
+ # The +notify_od_delete_user+ event.
295
+ NOTIFY_OD_DELETE_USER = :notify_od_delete_user
296
+ # The +notify_od_delete_group+ event.
297
+ NOTIFY_OD_DELETE_GROUP = :notify_od_delete_group
298
+ # The +notify_xpc_connect+ event.
299
+ NOTIFY_XPC_CONNECT = :notify_xpc_connect
300
+ # The +notify_gatekeeper_user_override+ event.
301
+ NOTIFY_GATEKEEPER_USER_OVERRIDE = :notify_gatekeeper_user_override
302
+ # The +notify_tcc_modify+ event.
303
+ NOTIFY_TCC_MODIFY = :notify_tcc_modify
304
+ # The +reserved_0+ event.
305
+ RESERVED_0 = :reserved_0
306
+ # The +reserved_1+ event.
307
+ RESERVED_1 = :reserved_1
308
+ # The +reserved_2+ event.
309
+ RESERVED_2 = :reserved_2
310
+ # The +reserved_3+ event.
311
+ RESERVED_3 = :reserved_3
312
+ # The +reserved_4+ event.
313
+ RESERVED_4 = :reserved_4
314
+ # The +reserved_5+ event.
315
+ RESERVED_5 = :reserved_5
316
+ # The +reserved_6+ event.
317
+ RESERVED_6 = :reserved_6
318
+ # The +reserved_7+ event.
319
+ RESERVED_7 = :reserved_7
320
+ # The +reserved_8+ event.
321
+ RESERVED_8 = :reserved_8
322
+ # Exclusive upper bound for event enum values.
323
+ LAST = 157
324
+ # Event symbols keyed by their SDK enum values.
325
+ SYMBOL_TO_VALUE = {
326
+ auth_exec: 0,
327
+ auth_open: 1,
328
+ auth_kextload: 2,
329
+ auth_mmap: 3,
330
+ auth_mprotect: 4,
331
+ auth_mount: 5,
332
+ auth_rename: 6,
333
+ auth_signal: 7,
334
+ auth_unlink: 8,
335
+ notify_exec: 9,
336
+ notify_open: 10,
337
+ notify_fork: 11,
338
+ notify_close: 12,
339
+ notify_create: 13,
340
+ notify_exchangedata: 14,
341
+ notify_exit: 15,
342
+ notify_get_task: 16,
343
+ notify_kextload: 17,
344
+ notify_kextunload: 18,
345
+ notify_link: 19,
346
+ notify_mmap: 20,
347
+ notify_mprotect: 21,
348
+ notify_mount: 22,
349
+ notify_unmount: 23,
350
+ notify_iokit_open: 24,
351
+ notify_rename: 25,
352
+ notify_setattrlist: 26,
353
+ notify_setextattr: 27,
354
+ notify_setflags: 28,
355
+ notify_setmode: 29,
356
+ notify_setowner: 30,
357
+ notify_signal: 31,
358
+ notify_unlink: 32,
359
+ notify_write: 33,
360
+ auth_file_provider_materialize: 34,
361
+ notify_file_provider_materialize: 35,
362
+ auth_file_provider_update: 36,
363
+ notify_file_provider_update: 37,
364
+ auth_readlink: 38,
365
+ notify_readlink: 39,
366
+ auth_truncate: 40,
367
+ notify_truncate: 41,
368
+ auth_link: 42,
369
+ notify_lookup: 43,
370
+ auth_create: 44,
371
+ auth_setattrlist: 45,
372
+ auth_setextattr: 46,
373
+ auth_setflags: 47,
374
+ auth_setmode: 48,
375
+ auth_setowner: 49,
376
+ auth_chdir: 50,
377
+ notify_chdir: 51,
378
+ auth_getattrlist: 52,
379
+ notify_getattrlist: 53,
380
+ notify_stat: 54,
381
+ notify_access: 55,
382
+ auth_chroot: 56,
383
+ notify_chroot: 57,
384
+ auth_utimes: 58,
385
+ notify_utimes: 59,
386
+ auth_clone: 60,
387
+ notify_clone: 61,
388
+ notify_fcntl: 62,
389
+ auth_getextattr: 63,
390
+ notify_getextattr: 64,
391
+ auth_listextattr: 65,
392
+ notify_listextattr: 66,
393
+ auth_readdir: 67,
394
+ notify_readdir: 68,
395
+ auth_deleteextattr: 69,
396
+ notify_deleteextattr: 70,
397
+ auth_fsgetpath: 71,
398
+ notify_fsgetpath: 72,
399
+ notify_dup: 73,
400
+ auth_settime: 74,
401
+ notify_settime: 75,
402
+ notify_uipc_bind: 76,
403
+ auth_uipc_bind: 77,
404
+ notify_uipc_connect: 78,
405
+ auth_uipc_connect: 79,
406
+ auth_exchangedata: 80,
407
+ auth_setacl: 81,
408
+ notify_setacl: 82,
409
+ notify_pty_grant: 83,
410
+ notify_pty_close: 84,
411
+ auth_proc_check: 85,
412
+ notify_proc_check: 86,
413
+ auth_get_task: 87,
414
+ auth_searchfs: 88,
415
+ notify_searchfs: 89,
416
+ auth_fcntl: 90,
417
+ auth_iokit_open: 91,
418
+ auth_proc_suspend_resume: 92,
419
+ notify_proc_suspend_resume: 93,
420
+ notify_cs_invalidated: 94,
421
+ notify_get_task_name: 95,
422
+ notify_trace: 96,
423
+ notify_remote_thread_create: 97,
424
+ auth_remount: 98,
425
+ notify_remount: 99,
426
+ auth_get_task_read: 100,
427
+ notify_get_task_read: 101,
428
+ notify_get_task_inspect: 102,
429
+ notify_setuid: 103,
430
+ notify_setgid: 104,
431
+ notify_seteuid: 105,
432
+ notify_setegid: 106,
433
+ notify_setreuid: 107,
434
+ notify_setregid: 108,
435
+ auth_copyfile: 109,
436
+ notify_copyfile: 110,
437
+ notify_authentication: 111,
438
+ notify_xp_malware_detected: 112,
439
+ notify_xp_malware_remediated: 113,
440
+ notify_lw_session_login: 114,
441
+ notify_lw_session_logout: 115,
442
+ notify_lw_session_lock: 116,
443
+ notify_lw_session_unlock: 117,
444
+ notify_screensharing_attach: 118,
445
+ notify_screensharing_detach: 119,
446
+ notify_openssh_login: 120,
447
+ notify_openssh_logout: 121,
448
+ notify_login_login: 122,
449
+ notify_login_logout: 123,
450
+ notify_btm_launch_item_add: 124,
451
+ notify_btm_launch_item_remove: 125,
452
+ notify_profile_add: 126,
453
+ notify_profile_remove: 127,
454
+ notify_su: 128,
455
+ notify_authorization_petition: 129,
456
+ notify_authorization_judgement: 130,
457
+ notify_sudo: 131,
458
+ notify_od_group_add: 132,
459
+ notify_od_group_remove: 133,
460
+ notify_od_group_set: 134,
461
+ notify_od_modify_password: 135,
462
+ notify_od_disable_user: 136,
463
+ notify_od_enable_user: 137,
464
+ notify_od_attribute_value_add: 138,
465
+ notify_od_attribute_value_remove: 139,
466
+ notify_od_attribute_set: 140,
467
+ notify_od_create_user: 141,
468
+ notify_od_create_group: 142,
469
+ notify_od_delete_user: 143,
470
+ notify_od_delete_group: 144,
471
+ notify_xpc_connect: 145,
472
+ notify_gatekeeper_user_override: 146,
473
+ notify_tcc_modify: 147,
474
+ reserved_0: 148,
475
+ reserved_1: 149,
476
+ reserved_2: 150,
477
+ reserved_3: 151,
478
+ reserved_4: 152,
479
+ reserved_5: 153,
480
+ reserved_6: 154,
481
+ reserved_7: 155,
482
+ reserved_8: 156
483
+ }.freeze
484
+ # SDK enum values keyed by event symbol.
485
+ VALUE_TO_SYMBOL = SYMBOL_TO_VALUE.invert.freeze
486
+ # All events known to the build SDK.
487
+ ALL = SYMBOL_TO_VALUE.keys.freeze
488
+ # All authorization events.
489
+ ALL_AUTH = ALL.select { |event| event.to_s.start_with?("auth_") }.freeze
490
+ # All notification events.
491
+ ALL_NOTIFY = ALL.select { |event| event.to_s.start_with?("notify_") }.freeze
492
+ # Undocumented reserved event slots.
493
+ RESERVED = [:reserved_0, :reserved_1, :reserved_2, :reserved_3, :reserved_4, :reserved_5, :reserved_6, :reserved_7, :reserved_8].freeze
494
+ # Events for which Endpoint Security accepts cached responses.
495
+ CACHEABLE = [:auth_exec, :auth_open, :auth_mmap, :auth_mount, :auth_setflags, :auth_setmode, :auth_setowner, :auth_chdir, :auth_getattrlist, :auth_chroot, :auth_utimes, :auth_getextattr, :auth_listextattr, :auth_readdir, :auth_fsgetpath, :auth_uipc_connect, :auth_proc_check, :auth_get_task, :auth_searchfs, :auth_get_task_read].freeze
496
+
497
+ module_function
498
+
499
+ # @return [Array<Symbol>] all events
500
+ def all = ALL
501
+ # @return [Array<Symbol>] authorization events
502
+ def all_auth = ALL_AUTH
503
+ # @return [Array<Symbol>] notification events
504
+ def all_notify = ALL_NOTIFY
505
+ # @return [Boolean] whether +event+ is an authorization event
506
+ def auth?(event) = event.to_s.start_with?("auth_")
507
+ # @return [Boolean] whether +event+ is a notification event
508
+ def notify?(event) = event.to_s.start_with?("notify_")
509
+ # @return [Boolean] whether +event+ is an undocumented reserved slot
510
+ def reserved?(event) = RESERVED.include?(event.to_sym)
511
+ # @return [Boolean] whether +event+ accepts a cached response
512
+ def cacheable?(event) = CACHEABLE.include?(event.to_sym)
513
+ # @return [Boolean] whether +event+ uses a flags response
514
+ def flags_response?(event) = event.to_sym == :auth_open
515
+ # @return [Integer] SDK enum value for +event+
516
+ def value(event) = SYMBOL_TO_VALUE.fetch(event.to_sym)
517
+ # @return [Symbol, Integer] event symbol, or +value+ when unknown
518
+ def symbol(value) = VALUE_TO_SYMBOL.fetch(value, value)
519
+ end
520
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EndpointSecurity
4
+ # A retained Endpoint Security message delivered to a handler.
5
+ class Message
6
+ # @return [Time]
7
+ def deadline_at
8
+ Time.now + time_left
9
+ end
10
+
11
+ # @return [Hash]
12
+ def to_h
13
+ {
14
+ version: version,
15
+ event_type: event_type,
16
+ action_type: action_type,
17
+ result: result,
18
+ time: time,
19
+ mach_time: mach_time,
20
+ deadline: deadline,
21
+ seq_num: seq_num,
22
+ global_seq_num: global_seq_num,
23
+ process: process&.to_h,
24
+ thread: thread&.to_h,
25
+ event: event&.to_h
26
+ }
27
+ end
28
+ end
29
+ end