Commit a312640
authored
fix: security hardening and code quality fixes
* Security hardening and code quality fixes
- Replace execSync with execFileSync to prevent shell injection (providers, executor, fetcher, publish)
- Add security headers: X-Content-Type-Options, X-Frame-Options, Content-Security-Policy, Referrer-Policy
- Add input validation for save route name field to prevent path traversal
- Fix rate limiter IP extraction (x-forwarded-for + x-real-ip fallback)
- Default server bind to 127.0.0.1 instead of 0.0.0.0
- CORS fallback to * (configurable via options.corsOrigin)
- Use execFileSync in publish submit (avoid shell injection when opening browser)
- TLS-aware health checks and HTTPS support in RemoteTransport
- Conditional rejectUnauthorized for TLS (self-signed configurable)
- Add **/.env.local patterns to .gitignore
- Formatting: double quotes, trailing commas (Prettier)
* fix: address CodeRabbit and Devin review findings from PR #74
- TLS: default allowSelfSigned=true to preserve self-signed cert workflow;
enforce rejectUnauthorized=true when trustedCAs are supplied in client context
- Signature verification: verifySecureMessage now cryptographically verifies
signatures using PeerIdentity.verifyHex instead of only checking fingerprints
- WebSocket: fix timeout handle leak in performClientHandshake; add error
logging to empty catch blocks; add per-socket error handler; pre-compute
signature once in broadcast(); add send error callbacks; reject startup if
TLS configured but certInfo missing
- Command parsing: replace broken regex tokenizer with shared splitCommand()
utility that correctly handles --flag="value with spaces"
- Rate limiter: prefer x-real-ip, fall back to rightmost x-forwarded-for entry
- Save route: scope IPv6 prefix checks to actual IPv6 addresses; stop leaking
internal error messages to clients
- Publish: extract shared parseSkillFrontmatter(); fix getRepoInfo to use
async execFileSync; fix path containment checks with separator
- Remote transport: add rejectUnauthorized option; bracket IPv6 in URLs;
fix host:port splitting for IPv6 with lastIndexOf
- Health checks: add tls/tlsAllowSelfSigned to Host type; pass https options
- Fetcher: validate owner/repo; derive indexDir from INDEX_PATH
- .gitignore: add recursive **/.env pattern, remove redundant entries
* fix(executor): restore shell feature support in shellExecutor
The previous security hardening replaced execSync with execFileSync,
which broke commands using pipes, redirects, and subshells. Now detects
shell metacharacters and falls back to sh -c for those commands while
keeping execFileSync for simple commands.1 parent 39b9453 commit a312640
File tree
22 files changed
+1430
-900
lines changed- packages
- api/src
- middleware
- routes
- cli/src/commands
- core/src
- executor
- plan
- providers
- recommend
- utils
- mesh/src
- peer
- security
- transport
- messaging/src/transport
- src/providers
22 files changed
+1430
-900
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
39 | 52 | | |
40 | 53 | | |
41 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | | - | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | | - | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | | - | |
| 34 | + | |
27 | 35 | | |
28 | | - | |
29 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
30 | 46 | | |
31 | | - | |
32 | 47 | | |
33 | 48 | | |
34 | 49 | | |
| |||
41 | 56 | | |
42 | 57 | | |
43 | 58 | | |
44 | | - | |
| 59 | + | |
45 | 60 | | |
46 | 61 | | |
47 | 62 | | |
48 | 63 | | |
49 | | - | |
| 64 | + | |
50 | 65 | | |
51 | 66 | | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
57 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
58 | 83 | | |
59 | 84 | | |
60 | 85 | | |
61 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
62 | 92 | | |
63 | 93 | | |
64 | 94 | | |
| |||
78 | 108 | | |
79 | 109 | | |
80 | 110 | | |
81 | | - | |
| 111 | + | |
82 | 112 | | |
83 | | - | |
84 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
85 | 116 | | |
86 | 117 | | |
87 | | - | |
| 118 | + | |
88 | 119 | | |
89 | 120 | | |
90 | | - | |
| 121 | + | |
91 | 122 | | |
92 | 123 | | |
93 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
34 | 44 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
48 | | - | |
| 58 | + | |
49 | 59 | | |
50 | 60 | | |
51 | | - | |
| 61 | + | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
| |||
0 commit comments