The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
security: stop the Jamf hook repair script handing the console user root (#809)
Justin D'Souza96b42be40585
diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex aa5d4d7e..50854284 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -12,6 +12,7 @@ Stay up to date with the latest changes to the Agent Beacon CLI.## October 2026- **Self-update installs only Beacon-signed packages, over https** · The macOS self-updater took the Apple team a package must be signed by from `update-manifest.json`, which is unsigned, matched it as a substring of the signature output, and skipped the check when the manifest named no team. Whoever could rewrite the manifest could have any notarized package installed as root. The team is now built into `beacon` (Asymptote Labs, `3A98D35XJR`) and must match the package's installer signer exactly, for self-update and the enterprise edition install alike. The manifest and the package must also be fetched over `https`, plain `http` only to a loopback mirror and never through a redirect, so a `managed.json` that names an `http://` update URL on another host stops updating until it is changed to `https`.+- **The Jamf hook repair script no longer hands the console user root** · `jamf/claude/common/repair-hooks.sh` runs as root. It granted the console user permission to add and delete entries in `/var/log/beacon-agent`, which let them replace the runtime log with a link that the root collector then opened, and it ran `chown -R` on `~/.beacon` as root, which a planted hard link turned into ownership of a root-run binary. The directory grant is gone, and the script now removes every grant that adds or deletes entries there, including ones earlier runs gave a previous console user and the one the Jamf guide's snippet used to add. It creates and fixes up `~/.beacon` as the user, refuses a symlinked directory, and moves aside one the user does not own. The Jamf guide explains how to remove the old grant by hand.- **The scheduled inventory job follows every moved runtime directory** · The job starts without your shell's environment, so a per-user install or repair records the variables that move a runtime's user directory into it. It recorded `CODEX_HOME`, `HERMES_HOME`, `CLINE_DIR`, `GEMINI_CLI_HOME` and `CLAUDE_CONFIG_DIR`, and now also `KIRO_HOME`, `KIMI_CODE_HOME`, `DSH_HOME`, `OH_PERSISTENCE_DIR`, `OPENCLAW_STATE_DIR`, `XDG_CONFIG_HOME` (Muse, and VS Code on Linux), `PI_CODING_AGENT_DIR`, `OMO_CODING_AGENT_DIR`, `SENPI_CODING_AGENT_DIR`, `PRIME_AGENT_CODING_AGENT_DIR`, and Oh My Pi's `PI_CONFIG_DIR`, `OMP_PROFILE` and `PI_PROFILE`. With one of these set only in your shell, the job used to inventory the default directory while the runtime read the moved one. See [Inventory heartbeats](/cli/endpoint-inventory#inventory-heartbeats).- **Pi extension follows `PI_CODING_AGENT_DIR`** · `beacon endpoint hooks install --harness pi`, `beacon endpoint discover` and inventory now use `$PI_CODING_AGENT_DIR/extensions/beacon.ts` when `PI_CODING_AGENT_DIR` is set, as Pi does, including a leading `~`. They previously always used `~/.pi/agent`, so with the variable set the extension went where Pi never loads it while discovery reported Pi as enabled, and live capture silently recorded nothing. Session status and sync already followed the variable; all of them now resolve the directory the same way.diff --git a/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx b/docs/guides/jamf-anthropic-openai-cursor-mdm.mdxindex 38d544f7..9adbe800 100644--- a/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx+++ b/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx@@ -276,13 +276,16 @@ chown "$CONSOLE_USER":wheel "$INVENTORY_LOG" "$INVENTORY_LOG.lock" "$INVENTORY_Schmod 755 "$RUNTIME_DIR"chmod 644 "$BEACON_HOOK_LOG_PATH" "$BEACON_HOOK_LOG_PATH.lock"chmod 664 "$INVENTORY_LOG" "$INVENTORY_LOG.lock" "$INVENTORY_STATE" "$INVENTORY_STATE.lock"-chmod +a "$CONSOLE_USER allow list,search,add_file,readattr,writeattr" "$RUNTIME_DIR" || truechmod +a "$CONSOLE_USER allow read,write,append,readattr,writeattr,readextattr,writeextattr" "$BEACON_HOOK_LOG_PATH" || truechmod +a "$CONSOLE_USER allow read,write,append,readattr,writeattr,readextattr,writeextattr" "$BEACON_HOOK_LOG_PATH.lock" || true/opt/beacon/jamf/scripts/install-cursor-hooks.sh```+<Warning>+Earlier versions of this script also ran `chmod +a "$CONSOLE_USER allow list,search,add_file,…" "$RUNTIME_DIR"`. That grant lets the user replace the runtime log with a link that the root collector then opens, so remove it on Macs that ran the old version. `ls -led /var/log/beacon-agent` lists the directory's entries by number; remove each `allow` entry that includes `add_file`, `add_subdirectory` or `delete_child` with `sudo chmod -a# <number> /var/log/beacon-agent`, highest number first. The Claude Jamf repair script does this itself.+</Warning>+Set Jamf parameter labels:| Parameter | Label | Example |diff --git a/packaging/macos/jamf/claude/common/repair-hooks.sh b/packaging/macos/jamf/claude/common/repair-hooks.shindex 67c85554..f4dace62 100755--- a/packaging/macos/jamf/claude/common/repair-hooks.sh+++ b/packaging/macos/jamf/claude/common/repair-hooks.sh@@ -70,16 +70,44 @@ echo "Console user: $CONSOLE_USER"echo "Home directory: $HOME_DIR"echo "Resetting Beacon hook binary ownership for $CONSOLE_USER..."-USER_GROUP="$(id -gn "$CONSOLE_USER")"HOOK_DIR="$HOME_DIR/.beacon/endpoint/hooks"HOOK_BIN="$HOOK_DIR/beacon-hooks"-mkdir -p "$HOOK_DIR"-chown -R "$CONSOLE_USER:$USER_GROUP" "$HOME_DIR/.beacon"-chmod 755 "$HOME_DIR/.beacon" "$HOME_DIR/.beacon/endpoint" "$HOOK_DIR"-rm -f "$HOOK_BIN"+# Everything under the user's home is created and changed as the user, never as+# root: the user controls these paths, so a root chown/chmod/rm there follows any+# symlink or hard link they planted (a hard link to /opt/beacon/bin/beacon would be+# handed to them by a recursive chown). A directory root left behind is renamed+# aside (rename never follows links) so the user can recreate it.+for dir in "$HOME_DIR/.beacon" "$HOME_DIR/.beacon/endpoint" "$HOOK_DIR"; do+ if [ -L "$dir" ]; then+ echo "Refusing to repair hooks: $dir is a symbolic link" >&2+ exit 1+ fi+ if [ -e "$dir" ] && [ "$(stat -f %Su "$dir")" != "$CONSOLE_USER" ]; then+ aside="$dir.not-owned.$(date +%Y%m%d%H%M%S)"+ echo "Moving $dir (not owned by $CONSOLE_USER) aside to $aside" >&2+ mv "$dir" "$aside"+ fi+done+sudo -u "$CONSOLE_USER" mkdir -p "$HOOK_DIR"+sudo -u "$CONSOLE_USER" chmod 755 "$HOME_DIR/.beacon" "$HOME_DIR/.beacon/endpoint" "$HOOK_DIR"+sudo -u "$CONSOLE_USER" rm -f "$HOOK_BIN"echo "Granting $CONSOLE_USER append access to Beacon runtime and inventory logs..."-chmod +a "$CONSOLE_USER allow list,search,add_file,delete_child,readattr,writeattr" "$RUNTIME_DIR" || true+# The directory stays root-owned 0755 with no grant to add or remove entries: hooks only append+# to the files below. Such a grant would let a user swap a log for a link that the root collector+# and inventory job then open. Earlier versions of this script, and the Jamf guide's snippet,+# granted add_file (with or without delete_child) to whoever was the console user then, so every+# such allow entry is removed, whoever it names, highest index first so the indexes still to+# remove do not shift. Read-only grants stay.+revoke_entry_grants() {+ ls -led "$1" |+ awk '$1 ~ /^[0-9]+:$/ && / allow / && /add_file|add_subdirectory|delete_child/ { sub(":", "", $1); print $1 }' |+ sort -rn |+ while read -r index; do+ chmod -a# "$index" "$1"+ done+}+revoke_entry_grants "$RUNTIME_DIR"chmod +a "$CONSOLE_USER allow read,write,append,readattr,writeattr,readextattr,writeextattr" "$RUNTIME_LOG" || truechmod +a "$CONSOLE_USER allow read,write,append,readattr,writeattr,readextattr,writeextattr" "$RUNTIME_LOCK" || truechmod +a "$CONSOLE_USER allow read,write,append,readattr,writeattr,readextattr,writeextattr" "$INVENTORY_LOG" || truediff --git a/packaging/macos/test-endpoint-scripts.sh b/packaging/macos/test-endpoint-scripts.shindex 6314e8fe..cb64ac07 100644--- a/packaging/macos/test-endpoint-scripts.sh+++ b/packaging/macos/test-endpoint-scripts.sh@@ -34,6 +34,16 @@ if ! grep -q 'INVENTORY_STATE' "$ROOT_DIR/packaging/macos/jamf/claude/common/repecho "repair-hooks should prepare inventory heartbeat state files" >&2exit 1fi+REPAIR_HOOKS_SCRIPT="$ROOT_DIR/packaging/macos/jamf/claude/common/repair-hooks.sh"+JAMF_GUIDE="$ROOT_DIR/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx"+if grep -q 'chown -R' "$REPAIR_HOOKS_SCRIPT" || grep -q 'chmod +a "$CONSOLE_USER allow[^"]*add_file' "$REPAIR_HOOKS_SCRIPT"; then+ echo "repair-hooks must not chown the user's home recursively as root or let the user add entries to the root log directory" >&2+ exit 1+fi+if grep -q 'chmod +a "$CONSOLE_USER allow[^"]*add_file[^"]*" "$RUNTIME_DIR" ||' "$JAMF_GUIDE"; then+ echo "the Jamf guide's snippet must not let the console user add entries to the root log directory" >&2+ exit 1+fiif ! grep -q 'restore_existing_forwarder' "$ROOT_DIR/packaging/macos/scripts/postinstall"; thenecho "postinstall should restore existing optional forwarders" >&2exit 1