fix(enrichment): bound EOL runtime lookups - #1546
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary Nits (5)
Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. This change introduces three module-level caps (`MAX_EOL_FILES=40`, `MAX_EOL_PATCH_LINES=1000`, `MAX_EOL_PINS=80`) in `extractVersionPins` and a `cyclesByProduct` Map in `scanEol` to prevent fetch amplification against endoflife.date. The cap logic is correct: `filesScanned` only increments for files that have patches (patchless files are skipped before the counter, not after), `linesScanned` counts every patch line including context and removals rather than only additions (intentionally conservative), and the product cache correctly stores `null` fetch failures so a failed product is not retried within the same request. Both new regression tests faithfully exercise the cap and the cache-hit semantics. Nits (5)
🟩 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
endoflife.datefetch per distinct product:version, which allowed request amplification against the third‑party calendar API and risked degrading enrichment availability.Description
MAX_EOL_FILES,MAX_EOL_PATCH_LINES, andMAX_EOL_PINSand enforce them inextractVersionPinsto bound files scanned, patch lines scanned, and pins returned in a single request (review-enrichment/src/analyzers/eol-check.ts).cyclesByProductcache insidescanEolsofetchCycles(product)is invoked at most once per product per request and repeated version lookups reuse the cached calendar.review-enrichment/test/enrichment.test.tsthat assert extraction is capped and thatscanEolissues only one fetch per product (tests:extractVersionPins: caps attacker-controlled EOL scan inputandscanEol: caches endoflife.date cycles per product).Testing
cd review-enrichment && npm test, and the review-enrichment test suite passed (all tests in that package succeeded).npm run test:cilocally, but the run could not be completed in this environment due to unrelated tooling/coverage failures (TypeError: jsTokens is not a functionin the coverage tooling), so the full CI gate was not verified here.npm audit --audit-level=moderate, but the npm audit endpoint returned403 Forbiddenand the audit check could not be completed in this environment.Codex Task