fix(selfhost): bound config lint file reads - #3952
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3952 +/- ##
=======================================
Coverage 93.66% 93.66%
=======================================
Files 372 372
Lines 34856 34856
Branches 12743 12743
=======================================
Hits 32649 32649
Misses 1588 1588
Partials 619 619 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-07 07:54:02 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 4 non-blocking
Concerns raised — review before merging
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.
|
Motivation
config-lintCLI read files unbounded withreadFileSync, which could follow symlinks or read special/very large files before the parser's byte cap was applied, risking hangs or excessive memory use.Description
readManifestTextForLint(path)thatlstats the path, rejects symlinks, rejects non-regular files, checksstat.sizeagainstMAX_FOCUS_MANIFEST_BYTES, and only then callsreadFileSyncto return the UTF-8 text.MAX_FOCUS_MANIFEST_BYTESand wire the CLImain()to use the guarded reader and emit the existing usage/error output on pre-read failures.formatLintReporttests.Testing
git diff --checkand it passed.npx vitest run test/unit/gittensory-config-lint-script.test.tsand all tests passed.npm run typecheckwhich completed successfully.npm run test:ci; it progressed totest:coveragebut the run stalled due to pre-existingRangeError: Maximum call stack size exceededintest/unit/queue.test.tsunrelated to this change, preventing a full gate run.npm audit --audit-level=moderatebut the registry audit endpoint returned403 Forbidden, so the audit could not be completed.Codex Task