macadmins / macadmins/osquery-extension

Tables for SAP Privileges.app privileges_info and privileges_events

Open
#125 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
132
Forks
41
Avg merge
1d 48m
Merged PRs (30d)
3

Description

@grahamgilbert, I’d like to prepare a pull request for the upcoming release of [SAP Privileges 2.6.0](https://github.com/SAP/macOS-enterprise-privileges/releases).

For this I propose adding a new table to enhance insights from the widely used SAP Privileges App.

#### Goal
The goal is to provide detailed information, including:
- Whether the Privileges app is installed
- The version of the Privileges app
- The status of the Privileges system extension
- An audit trail of administrator privilege changes

My research and early testing of the new version led to the idea to make critical user privilege details easily visible with the macadmins osquery extension would be a valuable addition to the community.

#### Scope
I propose the addition of two new osquery tables within a single Go package located at `tables/privileges/`:

1. **privileges_info** — This table will provide information about the installation status, version, and extension state. It will always return exactly one row.
2. **privileges_events** — This table will capture privilege-change audit events sourced from `PrivilegesCLI --history --json`.

**Out of scope:**
- Correlating event timestamps from the CLI’s plain-text output (as the JSON stream does not provide per-event timestamps).
- Managing or altering privileges.
- Reading managed preferences for Privileges configuration.

This implementation requires Privileges version 2.6.0 or newer (audit history functionality was introduced in 2.6.0) with the system extension enabled. The solution involves shelling out to the bundled `PrivilegesCLI` located at its fixed path and parsing the returned JSON. No new dependencies will be introduced, and it will align with the existing pattern in this repository of wrapping a vendor CLI.

#### Proposed Tables

1. **privileges_info** — This table will always contain one row with the following structure:

| column | description |
|------------------|------------------------------------------------------------------------------------|
| installed | 1 if `/Applications/Privileges.app/Contents/MacOS/PrivilegesCLI` exists |
| version / build | Retrieved from `PrivilegesCLI --version` |
| extension_enabled | 1 if `PrivilegesCLI --extension status` indicates that the system extension is enabled |

2. **privileges_events** — This table will yield one row for each audit event from `PrivilegesCLI --history --json`:

| column | description |
|------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| event_type | Possible values: ADMIN_ADD, ADMIN_REMOVE, etc. |
| user | The account whose privileges were modified |
| subject | The individual who initiated the change (e.g., user) |
| executable, signing_id, team_id, cdhash, pid, ppid, is_platform_binary,| ESF data of the process that executed the change |
| is_es_client | |
| daemon_start_time | Start time of the daemon process (no per-event timestamp available) |
| last | Parameter column; e.g., `WHERE last = '3h'` maps to `--last 3h` (m, h, d) |

Contributor guide

Open the contributing guide

Research direction

Start by examining existing vendor CLI wrappers in the repository, then use the proposed tables/privileges/ package and the fixed PrivilegesCLI path as the entry points. Check the outputs of --version, --extension status, and --history --json, including the last parameter. Done means privileges_info returns one row and privileges_events exposes the specified audit fields without adding dependencies or managing privileges.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, macos
Domain
cli, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.