@aikidosec/safe-chain 1.3.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -348,3 +348,7 @@ pipeline {
348
348
  ```
349
349
 
350
350
  After setup, all subsequent package manager commands in your CI pipeline will automatically be protected by Aikido Safe Chain's malware detection.
351
+
352
+ # Troubleshooting
353
+
354
+ Having issues? See the [Troubleshooting Guide](https://github.com/AikidoSec/safe-chain/blob/main/docs/troubleshooting.md) for help with common problems.
@@ -0,0 +1,249 @@
1
+ # Troubleshooting
2
+
3
+ This guide helps you diagnose and resolve common issues with Aikido Safe Chain.
4
+
5
+ ## Verification & Diagnostics
6
+
7
+ ### Check Installation
8
+
9
+ ```bash
10
+ # Check version
11
+ safe-chain --version
12
+ ```
13
+
14
+ ### Verify Shell Integration
15
+
16
+ Run the verification command for your package manager:
17
+
18
+ ```bash
19
+ npm safe-chain-verify
20
+ pnpm safe-chain-verify
21
+ pip safe-chain-verify
22
+ uv safe-chain-verify
23
+
24
+ # Any other supported package manager: {packagemanager} safe-chain-verify
25
+ ```
26
+
27
+ Expected output: `OK: Safe-chain works!`
28
+
29
+ ### Test Malware Blocking
30
+
31
+ Verify that malware detection is working:
32
+
33
+ **For JavaScript/Node.js:**
34
+
35
+ ```bash
36
+ npm install safe-chain-test
37
+ ```
38
+
39
+ **For Python:**
40
+
41
+ ```bash
42
+ pip3 install safe-chain-pi-test
43
+ ```
44
+
45
+ These test packages are flagged as malware and should be blocked by Safe Chain.
46
+
47
+ ### Logging Options
48
+
49
+ Use logging flags to get more information:
50
+
51
+ ```bash
52
+ # Verbose mode - detailed diagnostic output for troubleshooting
53
+ npm install express --safe-chain-logging=verbose
54
+
55
+ # Silent mode - suppress all output except malware blocking
56
+ npm install express --safe-chain-logging=silent
57
+ ```
58
+
59
+ ## Common Issues
60
+
61
+ ### Shell Aliases Not Working After Installation
62
+
63
+ **Symptom:** Running `npm` shows regular npm instead of safe-chain wrapped version
64
+
65
+ **First step:** Restart your terminal (most common fix)
66
+
67
+ **Verify it's working:**
68
+
69
+ ```bash
70
+ type npm
71
+ ```
72
+
73
+ Should show: `npm is a function`
74
+
75
+ **If still not working:**
76
+
77
+ Check that your startup file sources safe-chain scripts from `~/.safe-chain/scripts/`:
78
+
79
+ - Bash: `~/.bashrc`
80
+ - Zsh: `~/.zshrc`
81
+ - Fish: `~/.config/fish/config.fish`
82
+ - PowerShell: `$PROFILE`
83
+
84
+ ### "Command Not Found: safe-chain"
85
+
86
+ **Symptom:** Binary not found in PATH
87
+
88
+ **First step:** Restart your terminal
89
+
90
+ **Check PATH:**
91
+
92
+ ```bash
93
+ echo $PATH
94
+ ```
95
+
96
+ Should include `~/.safe-chain/bin`
97
+
98
+ **If persists:** Re-run the installation script
99
+
100
+ ### Shell Aliases Persist After Uninstallation
101
+
102
+ **Symptom:** safe-chain commands still active after running uninstall script
103
+
104
+ **Steps:**
105
+
106
+ 1. Run `safe-chain teardown` (if binary still exists)
107
+ 2. Restart your terminal
108
+ 3. If still present, manually edit shell config files:
109
+ - Bash: `~/.bashrc`
110
+ - Zsh: `~/.zshrc`
111
+ - Fish: `~/.config/fish/config.fish`
112
+ - PowerShell: `$PROFILE`
113
+ 4. Remove lines that source scripts from `~/.safe-chain/scripts/`
114
+ 5. Restart terminal again
115
+
116
+ ## Manual Verification Steps
117
+
118
+ ### Check Installation Status
119
+
120
+ ```bash
121
+ # Check installation location (helps identify if installed via npm or as standalone binary)
122
+ which safe-chain
123
+
124
+ # Verify binary exists
125
+ ls ~/.safe-chain/bin/safe-chain
126
+
127
+ # Check version
128
+ safe-chain --version
129
+
130
+ # Test shell integration
131
+ type npm
132
+ type pip
133
+ ```
134
+
135
+ **Expected `which` output:**
136
+
137
+ - Standalone binary (correct): `~/.safe-chain/bin/safe-chain` or `/Users/<username>/.safe-chain/bin/safe-chain`
138
+ - npm global (outdated): path containing `node_modules` or nvm version paths
139
+
140
+ If `which` shows an npm installation, see [Check for Conflicting Installations](#check-for-conflicting-installations).
141
+
142
+ ### Check Shell Integration
143
+
144
+ ```bash
145
+ # Which shell you're using
146
+ echo $SHELL
147
+
148
+ # Check if startup file sources safe-chain
149
+ # For Bash:
150
+ grep safe-chain ~/.bashrc
151
+
152
+ # For Zsh:
153
+ grep safe-chain ~/.zshrc
154
+
155
+ # For Fish:
156
+ grep safe-chain ~/.config/fish/config.fish
157
+
158
+ # Verify scripts exist
159
+ ls ~/.safe-chain/scripts/
160
+ ```
161
+
162
+ ### Check for Conflicting Installations
163
+
164
+ > **Note:** The install/uninstall scripts automatically detect and remove conflicting installations, but you can manually check:
165
+
166
+ ```bash
167
+ # Check npm global
168
+ npm list -g @aikidosec/safe-chain
169
+
170
+ # Check Volta
171
+ volta list safe-chain
172
+
173
+ # Check nvm (all versions)
174
+ for version in $(nvm list | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+'); do
175
+ nvm exec "$version" npm list -g @aikidosec/safe-chain 2>/dev/null && echo "Found in $version"
176
+ done
177
+ ```
178
+
179
+ ## Manual Cleanup
180
+
181
+ > **Note:** The install and uninstall scripts automatically handle these cleanup steps. Use these manual commands only if automatic cleanup fails.
182
+
183
+ ### Remove npm Global Installation
184
+
185
+ ```bash
186
+ npm uninstall -g @aikidosec/safe-chain
187
+ ```
188
+
189
+ ### Remove Volta Installation
190
+
191
+ ```bash
192
+ volta uninstall @aikidosec/safe-chain
193
+ ```
194
+
195
+ ### Remove nvm Installations (All Versions)
196
+
197
+ ```bash
198
+ # Automated approach
199
+ for version in $(nvm list | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+'); do
200
+ nvm exec "$version" npm uninstall -g @aikidosec/safe-chain
201
+ done
202
+
203
+ # Or manual per version
204
+ nvm use <version>
205
+ npm uninstall -g @aikidosec/safe-chain
206
+ ```
207
+
208
+ ### Clean Shell Configuration Files
209
+
210
+ Manually remove safe-chain entries from:
211
+
212
+ - Bash: `~/.bashrc`
213
+ - Zsh: `~/.zshrc`
214
+ - Fish: `~/.config/fish/config.fish`
215
+ - PowerShell: `$PROFILE`
216
+
217
+ Look for and remove:
218
+
219
+ - Lines sourcing from `~/.safe-chain/scripts/`
220
+ - Any safe-chain related function definitions
221
+
222
+ ### Remove Installation Directory
223
+
224
+ ```bash
225
+ rm -rf ~/.safe-chain
226
+ ```
227
+
228
+ ## Getting More Information
229
+
230
+ ### Enable Verbose Logging
231
+
232
+ Get detailed diagnostic output:
233
+
234
+ ```bash
235
+ npm install express --safe-chain-logging=verbose
236
+ pip install requests --safe-chain-logging=verbose
237
+ ```
238
+
239
+ ### Report Issues
240
+
241
+ If you encounter problems:
242
+
243
+ 1. Visit [GitHub Issues](https://github.com/AikidoSec/safe-chain/issues)
244
+ 2. Include:
245
+ - Operating system and version
246
+ - Shell type and version
247
+ - `safe-chain --version` output
248
+ - Output from verification commands
249
+ - Verbose logs of the failing command
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikidosec/safe-chain",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "scripts": {
5
5
  "test": "node --test --experimental-test-module-mocks 'src/**/*.spec.js'",
6
6
  "test:watch": "node --test --watch --experimental-test-module-mocks 'src/**/*.spec.js'",
@@ -83,6 +83,6 @@ function wrapSafeChainCommand() {
83
83
  # If the aikido command is not available, print a warning and run the original command
84
84
  printSafeChainWarning "$original_cmd"
85
85
 
86
- command "$original_cmd" "$@"
86
+ command "$@"
87
87
  fi
88
88
  }
@@ -1,89 +0,0 @@
1
- # Migrating from npm global tool to binary installation
2
-
3
- If you previously installed safe-chain as an npm global package, you need to migrate to the binary installation.
4
-
5
- Depending on the version manager you're using, the uninstall process differs:
6
-
7
- ### Standard npm (no version manager)
8
-
9
- 1. **Clean up shell aliases:**
10
-
11
- ```bash
12
- safe-chain teardown
13
- ```
14
-
15
- 2. **Restart your terminal**
16
-
17
- 3. **Uninstall the npm package:**
18
-
19
- ```bash
20
- npm uninstall -g @aikidosec/safe-chain
21
- ```
22
-
23
- 4. **Install the binary version** (see [Installation](https://github.com/AikidoSec/safe-chain/blob/main/README.md#installation))
24
-
25
- ### nvm (Node Version Manager)
26
-
27
- **Important:** nvm installs global packages separately for each Node version, so safe-chain must be uninstalled from each version where it was installed.
28
-
29
- 1. **Clean up shell aliases:**
30
-
31
- ```bash
32
- safe-chain teardown
33
- ```
34
-
35
- 2. **Restart your terminal**
36
-
37
- 3. **Uninstall from all Node versions:**
38
-
39
- **Option A** - Automated script (recommended):
40
-
41
- ```bash
42
- for version in $(nvm list | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+'); do nvm use $version && npm uninstall -g @aikidosec/safe-chain; done
43
- ```
44
-
45
- **Option B** - Manual per version:
46
-
47
- ```bash
48
- nvm use <version>
49
- npm uninstall -g @aikidosec/safe-chain
50
- ```
51
-
52
- Repeat for each Node version where safe-chain was installed.
53
-
54
- 4. **Install the binary version** (see [Installation](https://github.com/AikidoSec/safe-chain/blob/main/README.md#installation))
55
-
56
- ### Volta
57
-
58
- 1. **Clean up shell aliases:**
59
-
60
- ```bash
61
- safe-chain teardown
62
- ```
63
-
64
- 2. **Restart your terminal**
65
-
66
- 3. **Uninstall the Volta package:**
67
-
68
- ```bash
69
- volta uninstall @aikidosec/safe-chain
70
- ```
71
-
72
- 4. **Install the binary version** (see [Installation](https://github.com/AikidoSec/safe-chain/blob/main/README.md#installation))
73
-
74
- ## Troubleshooting
75
-
76
- ### Shell aliases still present after migration
77
-
78
- 1. Run `safe-chain teardown` (if the binary is installed)
79
- 2. Manually remove any safe-chain entries from your shell config files:
80
- - Bash: `~/.bashrc`
81
- - Zsh: `~/.zshrc`
82
- - Fish: `~/.config/fish/config.fish`
83
- - PowerShell: `$PROFILE`
84
- 3. Restart your terminal
85
- 4. Re-run the install script
86
-
87
- ### "command not found: safe-chain" after migration
88
-
89
- The binary installation directory (`~/.safe-chain/bin`) may not be in your PATH. Restart your terminal. If the problem persists: re-run the installation of safe-chain.