パッケージインストール時に Device Protection を強制する
Aikido Device Protection が有効になっていないマシンでのパッケージインストールをブロックします。これにより、ポリシーだけに頼ることなく、開発ワークフローの一部として保護を強制できます。
これを使う理由
Section titled “これを使う理由”サプライチェーン攻撃は依存関係を通じて仕掛けられることがよくあります。Device Protection はインストール時に悪意のあるパッケージを検知しますが、それはエージェントが動作している場合に限られます。インストール前チェックを追加することで、開発者が保護されていないマシンで誤ってパッケージをインストールしてしまうことを防げます。
ほとんどのパッケージマネージャーは、インストール前に実行されるライフサイクルフックやラッパースクリプトをサポートしています。チェックが0以外の終了コードで終わると、インストールは中断され、開発者にわかりやすいメッセージが表示されます。
macOS
/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthyWindows
& "C:\Program Files\AikidoSecurity\EndpointProtection\scripts\Healthy.ps1"パッケージマネージャーの例
Section titled “パッケージマネージャーの例”npm
package.json に preinstall スクリプトを追加します。
{ "scripts": { "preinstall": "/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy" }}yarn / pnpm
yarn と pnpm はどちらも package.json の preinstall スクリプトを尊重します。
{ "scripts": { "preinstall": "/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy" }}pip / uv
pip と uv にはネイティブのインストール前フックがありません。インストールをラップする Makefile ターゲットを使用してください。
install: check-aikido pip install -r requirements.txt
check-aikido: /Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthypip install を直接実行する代わりに make install を実行してください。同じパターンは uv sync や poetry install にも適用できます。
Maven
pom.xml の validate フェーズに exec-maven-plugin を追加します。これは依存関係が解決される前に実行されます。
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>check-aikido</id> <phase>validate</phase> <goals><goal>exec</goal></goals> <configuration> <executable>bash</executable> <arguments> <argument>-c</argument> <argument>/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy</argument> </arguments> </configuration> </execution> </executions></plugin>NuGet
プロジェクトに .targets ファイル(例: CheckAikido.targets)を追加し、.csproj でインポートします。
<!-- CheckAikido.targets --><Project> <Target Name="CheckAikido" BeforeTargets="Restore"> <Exec Command="bash -c "/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy"" /> </Target></Project><!-- YourProject.csproj --><Import Project="CheckAikido.targets" />Git フック
Section titled “Git フック”Git フックはパッケージインストールではなく、コミットやチェックアウトの前に発火します。ただし、保護されていないマシンでのすべての git 操作をブロックしたいチームにとっては、有用な第2の防御ラインになります。
.git/hooks/pre-commit にチェックを追加します。
#!/bin/bash/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy実行権限を付与します。
chmod +x .git/hooks/pre-commit