Commit 353dc63
fix(security): crypto-strong session/terminal IDs in cli + mcp — bump 1.3.5
Replaces Math.random()-based ID generation (js/insecure-randomness) with
crypto.randomBytes — predictable session/terminal IDs are guessable and enable
session-fixation/hijacking:
- cli/mcp-tools/session-tools.ts ×2 (session create + rotate): the
session-${Date.now()}-${Math.random().toString(36).slice(2,8)} id → randomBytes(6).toString('hex').
- cli/mcp-tools/terminal-tools.ts ×2 (term ids): same swap.
- mcp/session-manager.ts generateSessionId(): third copy of the session-id
pattern (batch 1 fixed the v3/mcp + @swarmdo/shared copies; this @swarmdo/mcp
one was missed) → randomBytes(6).toString('hex').
randomBytes(6) = 48 bits hex (12 chars), stronger than the old ~31-bit base36
slice. Added 'node:crypto' imports. Build clean; tests pass: cli session/
terminal-encryption (14) + mcp-tools-deep (107), mcp suite (65).
Versioning: cli was at 1.3.2 while umbrella advanced to 1.3.4 (batches 7-8
bumped the umbrella for other bundled packages but not cli) — resynced the
cli+umbrella+bridge lockstep to 1.3.5; mcp 3.0.0-alpha.11. 5 insecure-randomness
alerts; ~15 first-party remain (other ID generators, next).
Co-Authored-By: Swarmdo <maintainers@swarmdo.com>1 parent 8090e30 commit 353dc63
8 files changed
Lines changed: 14 additions & 11 deletions
File tree
- swarmdo
- v3/@swarmdo
- cli
- src/mcp-tools
- mcp
- src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
165 | | - | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
536 | | - | |
| 537 | + | |
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
316 | | - | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
| |||
0 commit comments