hop-claude 1.0.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/README.md +574 -0
  3. package/SECURITY.md +280 -0
  4. package/bin/cli.js +6 -0
  5. package/dist/cli.d.ts +6 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +147 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/config/config-manager.d.ts +88 -0
  10. package/dist/config/config-manager.d.ts.map +1 -0
  11. package/dist/config/config-manager.js +334 -0
  12. package/dist/config/config-manager.js.map +1 -0
  13. package/dist/config/encryption-v2.d.ts +51 -0
  14. package/dist/config/encryption-v2.d.ts.map +1 -0
  15. package/dist/config/encryption-v2.js +93 -0
  16. package/dist/config/encryption-v2.js.map +1 -0
  17. package/dist/config/encryption.d.ts +36 -0
  18. package/dist/config/encryption.d.ts.map +1 -0
  19. package/dist/config/encryption.js +72 -0
  20. package/dist/config/encryption.js.map +1 -0
  21. package/dist/config/keychain.d.ts +56 -0
  22. package/dist/config/keychain.d.ts.map +1 -0
  23. package/dist/config/keychain.js +112 -0
  24. package/dist/config/keychain.js.map +1 -0
  25. package/dist/config/storage.d.ts +32 -0
  26. package/dist/config/storage.d.ts.map +1 -0
  27. package/dist/config/storage.js +87 -0
  28. package/dist/config/storage.js.map +1 -0
  29. package/dist/config/validator.d.ts +9 -0
  30. package/dist/config/validator.d.ts.map +1 -0
  31. package/dist/config/validator.js +53 -0
  32. package/dist/config/validator.js.map +1 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +10 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/types/index.d.ts +38 -0
  38. package/dist/types/index.d.ts.map +1 -0
  39. package/dist/types/index.js +2 -0
  40. package/dist/types/index.js.map +1 -0
  41. package/dist/ui/display.d.ts +25 -0
  42. package/dist/ui/display.d.ts.map +1 -0
  43. package/dist/ui/display.js +39 -0
  44. package/dist/ui/display.js.map +1 -0
  45. package/dist/ui/prompts.d.ts +52 -0
  46. package/dist/ui/prompts.d.ts.map +1 -0
  47. package/dist/ui/prompts.js +339 -0
  48. package/dist/ui/prompts.js.map +1 -0
  49. package/dist/utils/backup.d.ts +14 -0
  50. package/dist/utils/backup.d.ts.map +1 -0
  51. package/dist/utils/backup.js +27 -0
  52. package/dist/utils/backup.js.map +1 -0
  53. package/dist/utils/claude-launcher.d.ts +8 -0
  54. package/dist/utils/claude-launcher.d.ts.map +1 -0
  55. package/dist/utils/claude-launcher.js +68 -0
  56. package/dist/utils/claude-launcher.js.map +1 -0
  57. package/dist/utils/migration.d.ts +18 -0
  58. package/dist/utils/migration.d.ts.map +1 -0
  59. package/dist/utils/migration.js +176 -0
  60. package/dist/utils/migration.js.map +1 -0
  61. package/dist/utils/platform.d.ts +19 -0
  62. package/dist/utils/platform.d.ts.map +1 -0
  63. package/dist/utils/platform.js +91 -0
  64. package/dist/utils/platform.js.map +1 -0
  65. package/package.json +54 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,316 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - # v0.1.0 - Major Security Update and Multi-Mode Encryption
8
+
9
+ This is a major security and feature update with critical fixes and new encryption capabilities.
10
+
11
+ ## ๐Ÿ”’ Critical Security Fixes
12
+
13
+ - **CRITICAL**: Fixed command injection vulnerability (CVE-pending)
14
+
15
+ - Removed `shell: true` from subprocess spawning
16
+ - Implemented safe binary detection for cross-platform support
17
+ - All user inputs now properly sanitized
18
+
19
+ - **Improved Windows Binary Detection**
20
+
21
+ - Support for claude.cmd, claude.exe, and claude binaries
22
+ - Uses `which` package for reliable PATH resolution
23
+ - Graceful fallback if binary not found
24
+
25
+ - **Enhanced Error Handling**
26
+ - Migrated from `error: any` to `error: unknown` for type safety
27
+ - Improved error messages and debugging support
28
+ - Better handling of edge cases
29
+
30
+ ## ๐Ÿ†• New Encryption Modes
31
+
32
+ ### Keychain Mode (Recommended) โญ
33
+
34
+ - Integration with OS-managed keychains:
35
+ - macOS: Keychain Access
36
+ - Windows: Credential Manager
37
+ - Linux: libsecret
38
+ - Hardware-backed encryption when available
39
+ - No password required for daily use
40
+ - Maximum security for single-machine usage
41
+
42
+ ### Passphrase Mode
43
+
44
+ - AES-256-GCM encryption with user-provided password
45
+ - PBKDF2 key derivation (100,000 iterations)
46
+ - Fully portable across machines
47
+ - Session passphrase caching for convenience
48
+
49
+ ### Legacy Mode (Deprecated)
50
+
51
+ - Backwards compatible with v0.0.x
52
+ - Machine-bound encryption (hostname + username)
53
+ - Users should migrate to Keychain or Passphrase mode
54
+
55
+ ## ๐Ÿ”„ Migration Features
56
+
57
+ - `--migrate-encryption`: Interactive migration tool
58
+
59
+ - Automatic backup before migration
60
+ - Guided selection of new encryption mode
61
+ - Data integrity verification
62
+ - Rollback support if migration fails
63
+
64
+ - `--encryption-info`: View current encryption mode
65
+ - Display security level
66
+ - Show recommendations
67
+ - List limitations
68
+
69
+ ## ๐Ÿ›ก๏ธ Reliability Improvements
70
+
71
+ - **File Locking**: Prevents corruption from concurrent access
72
+
73
+ - Uses `proper-lockfile` with retry logic
74
+ - Safe for multiple terminal sessions
75
+ - Automatic lock cleanup
76
+
77
+ - **Cross-Platform File Permissions**
78
+ - Unix: 0700 directory, 0600 file permissions
79
+ - Windows: ACL restrictions to current user
80
+ - Enhanced error handling and user guidance
81
+
82
+ ## โœ… Testing
83
+
84
+ - 31 comprehensive tests covering:
85
+ - Security (command injection, encryption algorithms)
86
+ - Concurrency (file locking, race conditions)
87
+ - Migration (all mode combinations)
88
+ - Edge cases (special characters, empty configs, wrong passwords)
89
+ - 99 assertions ensuring code quality
90
+
91
+ ## ๐Ÿ“– Documentation
92
+
93
+ - Complete SECURITY.md with:
94
+
95
+ - Security model explanation
96
+ - Threat model analysis
97
+ - Best practices for each mode
98
+ - Migration guide
99
+ - Known issues and changelog
100
+
101
+ - Updated README with:
102
+ - New features documentation
103
+ - Migration instructions
104
+ - Troubleshooting guide
105
+ - Testing information
106
+
107
+ ## โš ๏ธ Breaking Changes
108
+
109
+ None - fully backwards compatible with v0.0.x configs. Legacy mode is deprecated but still functional.
110
+
111
+ ## ๐Ÿ“ฆ Migration Path
112
+
113
+ For v0.0.x users:
114
+
115
+ ```bash
116
+ # Backup your current config
117
+ hop-claude -e backup-before-migration.json
118
+
119
+ # Run migration
120
+ hop-claude --migrate-encryption
121
+
122
+ # Verify new mode
123
+ hop-claude --encryption-info
124
+ ```
125
+
126
+ ## ๐Ÿ”— Dependencies
127
+
128
+ New dependencies added:
129
+
130
+ - `keytar`: ^7.9.0 (OS keychain integration)
131
+ - `proper-lockfile`: ^4.1.2 (file locking)
132
+ - `which`: ^6.0.0 (binary detection)
133
+
134
+ All notable changes to this project will be documented in this file.
135
+
136
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
137
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
138
+
139
+ ## [0.1.0] - 2025-01-03
140
+
141
+ ### ๐Ÿ”’ Security
142
+
143
+ #### Fixed
144
+
145
+ - **CRITICAL**: Command injection vulnerability via `shell: true` in subprocess spawning
146
+ - Removed shell interpretation of user inputs
147
+ - Implemented safe binary detection using `which` package
148
+ - Added comprehensive security tests to prevent regression
149
+
150
+ #### Added
151
+
152
+ - **Keychain Mode**: OS-managed keychain integration for maximum security
153
+ - macOS: Keychain Access
154
+ - Windows: Credential Manager
155
+ - Linux: libsecret support
156
+ - **Passphrase Mode**: Portable password-based encryption
157
+ - AES-256-GCM encryption
158
+ - PBKDF2 key derivation with 100,000 iterations
159
+ - Session passphrase caching
160
+ - File locking to prevent concurrent write corruption
161
+ - Uses `proper-lockfile` with retry logic
162
+ - Safe for multiple terminal sessions
163
+ - Enhanced type safety: migrated from `error: any` to `error: unknown`
164
+
165
+ ### โœจ Features
166
+
167
+ #### Added
168
+
169
+ - `--migrate-encryption`: Interactive encryption mode migration tool
170
+ - Automatic backup before migration
171
+ - Support for all mode combinations (Legacy โ†” Keychain โ†” Passphrase)
172
+ - Data integrity verification
173
+ - `--encryption-info`: View current encryption mode and recommendations
174
+ - Improved Windows binary detection
175
+ - Supports claude.cmd, claude.exe, and claude
176
+ - Graceful fallback if binary not found
177
+ - Enhanced Windows ACL error handling with user guidance
178
+
179
+ ### ๐Ÿงช Testing
180
+
181
+ #### Added
182
+
183
+ - Comprehensive test suite with 31 tests:
184
+ - `test/security.test.ts`: Command injection, encryption, keychain, file permissions
185
+ - `test/concurrent.test.ts`: File locking, race conditions, performance
186
+ - `test/migration.test.ts`: All encryption mode combinations
187
+ - 99 assertions covering security, reliability, and edge cases
188
+
189
+ ### ๐Ÿ“š Documentation
190
+
191
+ #### Added
192
+
193
+ - `SECURITY.md`: Complete security policy
194
+ - Detailed encryption mode explanations
195
+ - Threat model analysis
196
+ - Security best practices
197
+ - Migration guide
198
+ - Security changelog
199
+ - Updated `README.md`:
200
+ - New encryption modes documentation
201
+ - Migration instructions
202
+ - Enhanced troubleshooting guide
203
+ - Testing information
204
+ - Version history
205
+
206
+ ### ๐Ÿ“ฆ Dependencies
207
+
208
+ #### Added
209
+
210
+ - `keytar@^7.9.0`: OS keychain integration
211
+ - `proper-lockfile@^4.1.2`: File locking support
212
+ - `which@^6.0.0`: Cross-platform binary detection
213
+ - `@types/proper-lockfile@^4.1.4`: TypeScript definitions
214
+ - `@types/which@^3.0.4`: TypeScript definitions
215
+
216
+ ### โš ๏ธ Deprecated
217
+
218
+ - **Legacy encryption mode**: Still functional for backwards compatibility but deprecated
219
+ - Users should migrate to Keychain (recommended) or Passphrase mode
220
+ - Run `hop-claude --migrate-encryption` to upgrade
221
+
222
+ ### ๐Ÿ”„ Changed
223
+
224
+ - Configuration file structure now includes optional `encryptionMode` field
225
+ - Improved error messages and debugging output
226
+ - Enhanced cross-platform file permissions handling
227
+
228
+ ### ๐Ÿ’” Breaking Changes
229
+
230
+ None - fully backwards compatible with v0.0.x configurations.
231
+
232
+ ## [0.0.1] - Initial Release
233
+
234
+ ### Added
235
+
236
+ - Basic configuration management for Claude Code CLI
237
+ - API key encryption with machine-bound keys (Legacy mode)
238
+ - Multi-profile support
239
+ - Interactive CLI interface
240
+ - Configuration import/export
241
+ - API key validation
242
+ - Automatic Claude CLI launching
243
+ - Cross-platform support (macOS, Linux, Windows)
244
+
245
+ ---
246
+
247
+ ## Migration Guide
248
+
249
+ ### From v0.0.x to v0.1.0
250
+
251
+ 1. **Backup your current configuration**:
252
+
253
+ ```bash
254
+ hop-claude -e backup-before-migration.json
255
+ ```
256
+
257
+ 2. **Run the migration tool**:
258
+
259
+ ```bash
260
+ hop-claude --migrate-encryption
261
+ ```
262
+
263
+ 3. **Select your preferred encryption mode**:
264
+
265
+ - **Keychain** (recommended for single-machine usage): Maximum security, no password needed
266
+ - **Passphrase** (for multi-machine usage): Portable, requires password
267
+
268
+ 4. **Verify the migration**:
269
+ ```bash
270
+ hop-claude --encryption-info
271
+ ```
272
+
273
+ ### Emergency Recovery
274
+
275
+ If migration fails:
276
+
277
+ ```bash
278
+ # Restore from backup
279
+ hop-claude -i backup-before-migration.json
280
+
281
+ # Or manually restore
282
+ # macOS/Linux:
283
+ cp ~/.hop-claude-config/config.json.backup-TIMESTAMP ~/.hop-claude-config/config.json
284
+
285
+ # Windows:
286
+ copy %APPDATA%\hop-claude-config\config.json.backup-TIMESTAMP %APPDATA%\hop-claude-config\config.json
287
+ ```
288
+
289
+ ## Security Advisories
290
+
291
+ ### CVE-pending (Fixed in v0.1.0)
292
+
293
+ **Command Injection Vulnerability in v0.0.x**
294
+
295
+ - **Severity**: CRITICAL
296
+ - **Affected Versions**: v0.0.x and earlier
297
+ - **Fixed Version**: v0.1.0+
298
+ - **Description**: The use of `shell: true` in subprocess spawning allowed command injection through malicious profile names or configuration values.
299
+ - **Impact**: Local attackers could execute arbitrary commands by crafting malicious inputs.
300
+ - **Mitigation**: Upgrade to v0.1.0 or later immediately.
301
+
302
+ ### Weak Encryption in Legacy Mode
303
+
304
+ - **Severity**: HIGH
305
+ - **Affected Versions**: All versions with Legacy mode enabled
306
+ - **Mitigation**: Migrate to Keychain or Passphrase mode using `hop-claude --migrate-encryption`
307
+ - **Description**: Legacy mode uses machine-bound encryption (hostname + username) which provides obfuscation rather than true security.
308
+ - **Impact**: Local attackers with filesystem access can decrypt API keys.
309
+
310
+ ---
311
+
312
+ ## Support
313
+
314
+ For security issues, please review [SECURITY.md](./SECURITY.md) for reporting procedures.
315
+
316
+ For general issues and feature requests, visit [GitHub Issues](https://github.com/0bipinnata0/hop-claude/issues).