パッケージのインストール中に Device Protection を強制する
Aikido Device Protection が有効でないマシンでのパッケージのインストールをブロックします。これにより、ポリシーだけに頼らず、開発ワークフローの一部として保護を強制できます。
これを使う理由
サプライチェーン攻撃は、依存関係を通じて侵入することがよくあります。Device Protection はインストール時に悪意のあるパッケージを遮断しますが、動作している場合に限ります。インストール前のチェックを追加することで、保護されていないマシンに誤ってパッケージをインストールすることを防げます。
仕組み
多くのパッケージマネージャーは、インストール前に実行されるライフサイクルフックやラッパースクリプトをサポートしています。チェックがゼロ以外のコードで終了すると、インストールは中止され、開発者には明確なメッセージが表示されます。
/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy& "C:\Program Files\AikidoSecurity\EndpointProtection\scripts\Healthy.ps1"パッケージマネージャーの例
以下の例では macOS のパスを使用しています。Windows では、上記の PowerShell コマンドに置き換えてください。
を追加します。 preinstall 用のスクリプト package.json:
{
"scripts": {
"preinstall": "'/Applications/Aikido Endpoint Protection.app/Contents/Resources/scripts/healthy'"
}
}yarn と pnpm はどちらも preinstall スクリプトを package.json:
{
"scripts": {
"preinstall": "'/Applications/Aikido Endpoint Protection.app/Contents/Resources/scripts/healthy'"
}
}pip と uv にはネイティブのインストール前フックがありません。代わりに Makefile インストールをラップするターゲットを使います:
install: check-aikido
pip install -r requirements.txt
check-aikido:
/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy実行します make install の代わりに pip install を直接使います。同じパターンは uv sync または poetry install.
次の exec-maven-plugin に validate フェーズに pom.xmlを追加します。これは依存関係が解決される前に実行されます:
<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>を追加します。 .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 フック
Git フックはコミットやチェックアウトの前に実行され、パッケージのインストール前ではありませんが、保護されていないマシンでのすべての git 操作をブロックしたいチームにとっては、追加の実施手段として有用です。
チェックを追加します .git/hooks/pre-commit:
#!/bin/bash
/Applications/Aikido\ Endpoint\ Protection.app/Contents/Resources/scripts/healthy実行可能にします:
chmod +x .git/hooks/pre-commit