English

Enforce Device Protection During Package Installation

Block package installations on machines where Aikido Device Protection is not active. This lets you enforce protection as part of your development workflow, without relying on policy alone.

Why use this

Supply chain attacks often arrive through dependencies. Device Protection intercepts malicious packages at install time but only if it's running. Adding a pre-install check ensures developers cannot accidentally install packages on an unprotected machine.

How it works

Most package managers support lifecycle hooks or wrapper scripts that run before installation. If the check exits with a non-zero code, the install is aborted and the developer sees a clear message.

/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy

Package manager examples

The examples below use the macOS path. On Windows, swap in the PowerShell command above.

Add a preinstall script to package.json:

{
  "scripts": {
    "preinstall": "'/Applications/Aikido Endpoint Protection.app/Contents/Resources/scripts/healthy'"
  }
}

Git hooks

Git hooks fire before commits or checkouts, not package installs, but they are a useful second line of enforcement for teams that want to block all git activity on unprotected machines.

Add the check to .git/hooks/pre-commit:

#!/bin/bash
/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy

Make it executable:

chmod +x .git/hooks/pre-commit

.git/hooks is not tracked by git. To share hooks with your team, use a tool like Lefthook or Husky to manage and commit hooks as part of your repository.