Don't continue if safe-chain wasn't found

Unless --safe-chain-malware-action=prompt is used
This commit is contained in:
Hans Ott 2025-10-13 16:56:01 +02:00
parent 5eedbfb57f
commit 12fd751baa
2 changed files with 50 additions and 7 deletions

View file

@ -77,10 +77,10 @@ To uninstall the Aikido Safe Chain, you can run the following command:
## Malware Action
You can control how Aikido Safe Chain responds when malware is detected using the `--safe-chain-malware-action` flag:
You can control how Aikido Safe Chain responds when malware is detected or when safe-chain is not available using the `--safe-chain-malware-action` flag:
- `--safe-chain-malware-action=block` (**default**) - Automatically blocks installation and exits with an error when malware is detected
- `--safe-chain-malware-action=prompt` - Prompts the user to decide whether to continue despite the malware detection
- `--safe-chain-malware-action=block` (**default**) - Automatically blocks installation and exits with an error when malware is detected or when safe-chain is unavailable
- `--safe-chain-malware-action=prompt` - Prompts the user to decide whether to continue despite the malware detection or missing safe-chain
Example usage:
@ -88,6 +88,12 @@ Example usage:
npm install suspicious-package --safe-chain-malware-action=prompt
```
### When Safe Chain is Not Available
By default, if the safe-chain commands (aikido-npm, aikido-yarn, etc.) are not found in your PATH, the command will be **blocked** to protect you from installing packages without malware scanning. This can happen when using version managers like [asdf](https://github.com/asdf-vm/asdf) where each Node version has its own global packages.
To continue in this situation, use the `prompt` mode: `npm install package --safe-chain-malware-action=prompt`
# Usage in CI/CD
You can protect your CI/CD pipelines from malicious packages by integrating Aikido Safe Chain into your build process. This ensures that any packages installed during your automated builds are checked for malware before installation.