kodelyth-ecc 2.24.1 → 2.24.2
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/CHANGELOG.md +62 -0
- package/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/dashboard/server.js +12 -1
- package/scripts/mcp/catalog.js +22 -1
- package/scripts/memory/store.js +33 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,68 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Kodelyth ECC are documented here.
|
|
4
4
|
|
|
5
|
+
## v2.24.2 — adversarial pass: path traversal in get_rule, unrecallable memories (October 2026)
|
|
6
|
+
|
|
7
|
+
**Security fix.** Three defects found by attacking the memory store, MCP server
|
|
8
|
+
and dashboard rather than reading them.
|
|
9
|
+
|
|
10
|
+
### `get_rule` returned any markdown file on the machine
|
|
11
|
+
|
|
12
|
+
`loadRule` was the only catalog loader that built a filesystem path out of its
|
|
13
|
+
argument. Every other loader — agents, skills, commands, bundles — enumerates a
|
|
14
|
+
directory and matches by name, so a caller can only ever select something already
|
|
15
|
+
listed. This one did `path.join(PATHS.rules, name + '.md')`, so:
|
|
16
|
+
|
|
17
|
+
get_rule("../../README") -> 51,297 bytes of ROOT/README.md
|
|
18
|
+
get_rule("testing/../../../README") -> same, via nested traversal
|
|
19
|
+
|
|
20
|
+
The `.md` suffix was the only thing bounding the reach, which left every readable
|
|
21
|
+
markdown file on the machine in scope.
|
|
22
|
+
|
|
23
|
+
This matters because the caller is not always the user. An MCP tool argument can
|
|
24
|
+
originate in text the agent merely read — a dependency README, an issue comment,
|
|
25
|
+
a fetched page — which made this an arbitrary-markdown-read primitive reachable
|
|
26
|
+
by prompt injection. That is exactly the class ECC's own `prompt-injection-hunter`
|
|
27
|
+
agent exists to catch.
|
|
28
|
+
|
|
29
|
+
Fixed with two guards that fail differently: a name pattern that rejects anything
|
|
30
|
+
that is a path rather than a name before touching disk, and the existing
|
|
31
|
+
`resolveContained()` from `scripts/lib/safe-fs.js`, which proves the target sits
|
|
32
|
+
under `rules/common` once symlinks resolve. The pattern alone is not enough —
|
|
33
|
+
`escape-probe` is a valid rule name, and a symlink under that name reads 51KB.
|
|
34
|
+
|
|
35
|
+
`loadRule` had no test coverage at all, which is why this survived. It now has
|
|
36
|
+
four tests, including the symlink case.
|
|
37
|
+
|
|
38
|
+
### One memory was mathematically unrecallable
|
|
39
|
+
|
|
40
|
+
`search()` defaulted to an absolute `minScore` of 0.5 against unnormalised BM25
|
|
41
|
+
scores. BM25 IDF is `log(1 + (N - df + 0.5) / (df + 0.5))`, so a term appearing in
|
|
42
|
+
every memory drives IDF toward zero and can never clear a fixed floor at any
|
|
43
|
+
corpus size. The floor is now relative to the top hit, so it scales with the
|
|
44
|
+
corpus instead of fighting it. An explicitly passed `minScore` is still honoured
|
|
45
|
+
exactly. `recall_memory` passes none, so it was using the broken default.
|
|
46
|
+
|
|
47
|
+
### Malformed request URIs returned 500 and wrote to stderr
|
|
48
|
+
|
|
49
|
+
`decodeURIComponent` throws on `/%`, `/%zz` or a truncated `/%e0%a4`. The dashboard
|
|
50
|
+
did not guard it, so a malformed *client* URI became a 500 "internal server error"
|
|
51
|
+
plus one stderr line per request — meaning any local process could spam the
|
|
52
|
+
terminal the dashboard runs in. A path that cannot be decoded names no file, so
|
|
53
|
+
it is now a 404 like any other miss.
|
|
54
|
+
|
|
55
|
+
### What resisted
|
|
56
|
+
|
|
57
|
+
Worth recording, since the absence of findings was tested rather than assumed.
|
|
58
|
+
Dashboard traversal (plain, encoded, double-encoded, backslash, absolute,
|
|
59
|
+
null-byte) all returned 404. Host validation rejects absent, empty and foreign
|
|
60
|
+
`Host` headers. Non-GET is 405. Stored XSS was tested in a real browser: a memory
|
|
61
|
+
captured through the real store with breakout payloads in problem, approach, tags,
|
|
62
|
+
language and project rendered as visible text, setting no global, creating no
|
|
63
|
+
element and no attribute, with the `</pre>` breakout still inside its `<pre>`.
|
|
64
|
+
|
|
65
|
+
**665 tests across 43 files.**
|
|
66
|
+
|
|
5
67
|
## v2.24.1 — verify Windows downloads before running them (October 2026)
|
|
6
68
|
|
|
7
69
|
**Security fix.** The Windows installer added in 2.23.0 downloaded a release zip
|
package/CLAUDE.md
CHANGED
|
@@ -26,7 +26,7 @@ scripts/ → Node.js utilities: MCP server, dashboard, swarm, replay, router
|
|
|
26
26
|
bundles/ → 3 power bundles (indie-hacker, red-team, enterprise)
|
|
27
27
|
actions/ → GitHub Action (CI/CD integration for PR review)
|
|
28
28
|
docs/ → Feature docs (arena.md, mcp.md, dashboard.md, swarm.md, replay.md, evolve.md, supply-chain.md)
|
|
29
|
-
tests/ →
|
|
29
|
+
tests/ → 665 passing tests across 43 test files
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Running Tests
|
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ Most "AI agent kits" are folders of markdown files you have to remember the name
|
|
|
118
118
|
| Quality hooks | ✅ 44 | Some | ❌ | ❌ |
|
|
119
119
|
| IDE platforms | **11** (Claude Code, Windsurf, Cursor, Codex, Antigravity, OpenCode, Cline, Roo Code, Aider, Kimi, Gemini CLI) | 1-2 | 1 | Varies |
|
|
120
120
|
| Telemetry | ❌ none | Varies | ❌ | Varies |
|
|
121
|
-
| Test coverage | ✅
|
|
121
|
+
| Test coverage | ✅ 665 tests | ❌ | ❌ | ❌ |
|
|
122
122
|
| Distributed via | `npx`, curl, clone | Manual | Manual | Manual |
|
|
123
123
|
|
|
124
124
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodelyth-ecc",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.2",
|
|
4
4
|
"description": "Production-grade AI coding toolkit — 70 agents (incl. devil-mode adversarial crew), 196 skills, 103 commands, parallel multi-agent commands, semantic intent routing, self-learning memory, and a built-in MCP server (16 tools / 6 prompts / 377 resources) that bridges to Claude Desktop, LangGraph, AutoGen, CrewAI, and OpenAI Agents SDK. Works on macOS, Linux and Windows with Claude Code, Windsurf, Cursor, Codex, Antigravity, OpenCode, Cline, RooCode, Aider, Kimi, and Gemini CLI.",
|
|
5
5
|
"author": "Kodelyth <github.com/sifxprime>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -151,7 +151,18 @@ function serveStaticFile(res, filePath) {
|
|
|
151
151
|
// baseDir is injectable so the containment logic can be tested against a real
|
|
152
152
|
// symlink without planting one in the shipped static/ directory.
|
|
153
153
|
function resolveStatic(reqPath, baseDir = STATIC_DIR) {
|
|
154
|
-
|
|
154
|
+
// decodeURIComponent throws URIError on malformed percent-encoding — "/%",
|
|
155
|
+
// "/%zz", a truncated "/%e0%a4". That threw out to the route handler, which
|
|
156
|
+
// turned a client's malformed URI into a 500 "internal server error" and wrote
|
|
157
|
+
// a line to stderr, so any local process could both mislabel its own bad
|
|
158
|
+
// request as a server fault and spam the terminal the dashboard runs in.
|
|
159
|
+
// A path that cannot be decoded names no file, so it is simply not found.
|
|
160
|
+
let decoded;
|
|
161
|
+
try {
|
|
162
|
+
decoded = decodeURIComponent(reqPath.replace(/^\/+/, ''));
|
|
163
|
+
} catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
155
166
|
if (decoded.includes('..')) return null;
|
|
156
167
|
if (decoded === '' || decoded === '/') return path.join(baseDir, 'index.html');
|
|
157
168
|
// Containment, including symlink resolution — see scripts/lib/safe-fs.js.
|
package/scripts/mcp/catalog.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
+
const { resolveContained } = require('../lib/safe-fs');
|
|
11
12
|
|
|
12
13
|
const ROOT = path.join(__dirname, '..', '..');
|
|
13
14
|
|
|
@@ -157,8 +158,28 @@ function loadCommands() {
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
// ── Rules ────────────────────────────────────────────────────────────────────
|
|
161
|
+
// A rule name is a flat basename: rules/common has no subdirectories, and every
|
|
162
|
+
// other loader here resolves a name against a directory LISTING, so a caller can
|
|
163
|
+
// only ever select something already enumerated. This one built a path out of the
|
|
164
|
+
// argument instead, which made `../../README` read ROOT/README.md — any .md file
|
|
165
|
+
// the process could reach, through a tool whose contract is "return a rule".
|
|
166
|
+
//
|
|
167
|
+
// That matters because the caller is not always the user. An MCP tool argument
|
|
168
|
+
// can originate in text the agent merely read — a dependency's README, an issue
|
|
169
|
+
// comment, a fetched page — so this was an arbitrary-markdown-read primitive
|
|
170
|
+
// reachable by prompt injection, which is exactly what ECC's own
|
|
171
|
+
// prompt-injection-hunter agent exists to catch.
|
|
172
|
+
//
|
|
173
|
+
// Two guards, because they fail differently. The pattern rejects anything that is
|
|
174
|
+
// a path rather than a name, before touching disk. resolveContained then proves
|
|
175
|
+
// the target really sits under rules/common once symlinks are resolved, which a
|
|
176
|
+
// pattern cannot know.
|
|
177
|
+
const RULE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
178
|
+
|
|
160
179
|
function loadRule(name) {
|
|
161
|
-
|
|
180
|
+
if (typeof name !== 'string' || !RULE_NAME.test(name)) return null;
|
|
181
|
+
const file = resolveContained(path.join(PATHS.rules, `${name}.md`), PATHS.rules);
|
|
182
|
+
if (file === null) return null;
|
|
162
183
|
const raw = safeReadFile(file);
|
|
163
184
|
if (raw === null) return null;
|
|
164
185
|
return { name, file, relpath: path.relative(ROOT, file), body: raw };
|
package/scripts/memory/store.js
CHANGED
|
@@ -185,8 +185,33 @@ function indexMemory(index, memory) {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// ── BM25 retrieval (k1=1.5, b=0.75) ──────────────────────────────────────────
|
|
188
|
+
/**
|
|
189
|
+
* Fraction of the best hit's score a result must reach to be kept, when the
|
|
190
|
+
* caller does not impose an absolute floor of its own.
|
|
191
|
+
*
|
|
192
|
+
* Relative, not absolute, and that is the whole point. BM25 scores are not
|
|
193
|
+
* normalised — they scale with corpus size and term rarity — so any fixed
|
|
194
|
+
* threshold is really a statement about how many memories you have. The old
|
|
195
|
+
* default of 0.5 made a single stored memory mathematically unrecallable: with
|
|
196
|
+
* N=1 and df=1 the IDF term caps the score at ~0.288, so recall() returned
|
|
197
|
+
* nothing no matter what you searched for.
|
|
198
|
+
*
|
|
199
|
+
* It was worse for common words. A token appearing in every memory scores
|
|
200
|
+
* 0.288 at N=1, 0.087 at N=5 and 0.010 at N=50 — correct BM25 behaviour, since
|
|
201
|
+
* a term that is everywhere carries no signal, but under a fixed floor it meant
|
|
202
|
+
* those words never matched at any corpus size.
|
|
203
|
+
*
|
|
204
|
+
* Three call sites had already worked around this by passing minScore: 0.1
|
|
205
|
+
* (doctor and two tests, one of which names the ~0.29 figure outright). The
|
|
206
|
+
* user-facing paths had not: the MCP recall_memory tool, the memory CLI and
|
|
207
|
+
* SessionStart injection all used the default and silently returned nothing.
|
|
208
|
+
*/
|
|
209
|
+
const RELATIVE_SCORE_FLOOR = 0.25;
|
|
210
|
+
|
|
188
211
|
function search(query, options = {}) {
|
|
189
|
-
|
|
212
|
+
// minScore stays honoured when passed, so existing callers keep their exact
|
|
213
|
+
// behaviour; only the default changes from an absolute floor to a relative one.
|
|
214
|
+
const { limit = 5, minScore = null, projectFilter = null } = options;
|
|
190
215
|
const index = loadIndex();
|
|
191
216
|
const tokens = tokenise(query);
|
|
192
217
|
if (tokens.length === 0 || index.docCount === 0) return [];
|
|
@@ -208,9 +233,13 @@ function search(query, options = {}) {
|
|
|
208
233
|
}
|
|
209
234
|
}
|
|
210
235
|
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
236
|
+
const sorted = Object.entries(scores).sort(([, a], [, b]) => b - a);
|
|
237
|
+
const topScore = sorted.length ? sorted[0][1] : 0;
|
|
238
|
+
const floor = minScore !== null && minScore !== undefined
|
|
239
|
+
? minScore
|
|
240
|
+
: topScore * RELATIVE_SCORE_FLOOR;
|
|
241
|
+
const ranked = sorted
|
|
242
|
+
.filter(([, score]) => score >= floor)
|
|
214
243
|
.slice(0, limit * 3);
|
|
215
244
|
|
|
216
245
|
if (ranked.length === 0) return [];
|