fix(api): validate parsePositiveInt input to reject malformed numeric strings#1718
fix(api): validate parsePositiveInt input to reject malformed numeric strings#1718galuis116 wants to merge 2 commits into
Conversation
… strings Add regex validation to parsePositiveInt in src/api/routes.ts, src/github/webhook.ts, and src/orb/webhook.ts to ensure the entire string consists only of digits before parsing. This prevents partial parsing of malformed strings like '123abc' which would previously return 123 instead of null. Fixes JSONbored#1717
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-06-29 14:01:08 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 4 non-blocking
Why this is blocked
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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1718 +/- ##
==========================================
- Coverage 95.58% 95.58% -0.01%
==========================================
Files 204 204
Lines 22314 22307 -7
Branches 8066 8063 -3
==========================================
- Hits 21329 21322 -7
Misses 408 408
Partials 577 577
🚀 New features to boost your workflow:
|
…edback Move parsePositiveInt from local implementations in src/api/routes.ts, src/github/webhook.ts, and src/orb/webhook.ts to a shared utility in src/utils/json.ts. Update all call sites to import from the shared location and update the test to exercise the production function directly. Addresses Gittensory review feedback about test coverage and code duplication.
Add regex validation to parsePositiveInt in src/api/routes.ts, src/github/webhook.ts, and src/orb/webhook.ts to ensure the entire string consists only of digits before parsing. This prevents partial parsing of malformed strings like '123abc' which would previously return 123 instead of
ull.
Changes
Fixes #1717