fix(engine): cap miner goal list inspection - #2896
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 33b6b24 | Commit Preview URL Branch Preview URL |
Jul 04 2026, 04:24 AM |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-04 04:22:35 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
…d duplicate parser (#4318) Two independently-filed issues (#2652's follow-up to #2293, and #2301) both specified a MinerGoalSpec parser. Two implementations landed around the same time: miner-goal-spec.ts became canonical (re-exported from the package barrel, the only one packages/gittensory-miner's real caller actually imports), while miner-goal-spec-parse.ts's own PR explicitly avoided the barrel "while #2628 is open" as a temporary conflict-avoidance measure that was never reconciled -- it sat published as its own npm subpath export with zero real callers anywhere in the repo. More importantly: the canonical file has the exact resource-exhaustion bug that #2896 patched in its orphaned sibling and nowhere else. normalizeStringList's cap check only fired after a candidate was accepted, so an array of entries that always take the `continue` path (non-string, duplicate, or empty-after-trim) never hit the cap and got scanned in full -- a hostile `.gittensory-miner.yml` with thousands of duplicate/invalid list entries could force unbounded CPU/memory work and unbounded warning growth on every repo a miner considers, since this parser runs on untrusted per-repo config. - Bound normalizeStringList's iteration to the raw array index, before any per-entry work, mirroring #2896's fix -- but WITHOUT that fix's own latent bug: a trailing `result.length >= cap` break (kept for "defense in depth") fires silently, with no warning, whenever the input has exactly cap+1 unique valid entries. A pre-existing test ("caps oversized string lists and ignores extra entries") caught this regression during review. The index-based check alone is both necessary and sufficient to bound work; the trailing check is removed rather than mirrored. - Delete the orphaned miner-goal-spec-parse.ts and its dedicated test (confirmed zero real callers, in-repo or via its published subpath). - Remove the ./miner-goal-spec-parse subpath from package.json's exports map. BREAKING CHANGE: @jsonbored/gittensory-engine's published subpath export is removed. The package is one week old with a single in-repo consumer that never used this subpath; no known external impact. - Add hostile-input regression tests (all-non-string, all-duplicate, all-empty, all-overlong) to both the package-level and root-level test suites for the canonical parser, mirroring the coverage #2896 added for its now-deleted sibling.
Motivation
MinerGoalSpecstring-list parser only enforcedMAX_LIST_ENTRIESafter accepting valid unique strings, allowing malicious or malformed arrays to be scanned unbounded and generate unbounded warnings and CPU/memory work.Description
MAX_LIST_ENTRIESinspected entries by switching tofor (const [index, entry] of value.entries())and breaking with a capped warning when the limit is reached inpackages/gittensory-engine/src/miner-goal-spec-parse.ts.MinerGoalSpec field "<field>" is capped at 200 entries; dropping the rest.).nullentries, duplicates, empty strings, and overlong strings to assert parsing and warning growth are bounded inpackages/gittensory-engine/test/miner-goal-spec-parse.test.ts.Testing
git diff --checkpassed locally.npm --workspace @jsonbored/gittensory-engine testran the package suite and all tests passed (51 passing, 0 failing), including the new regression tests.npm run test:cicould not be completed in this environment due to an external actionlint setup/download DNS failure and the local actionlint WASM fallback flagging a self-hosted runner label, so the full repo gate was not executed here.npm audit --audit-level=moderatecould not be completed due to the registry audit endpoint returning a403in this environment.Codex Task