fix(api): sanitize block heights in account builders#2188
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 #2188 +/- ##
==========================================
+ Coverage 93.22% 93.29% +0.07%
==========================================
Files 52 52
Lines 8123 8119 -4
Branches 2978 2973 -5
==========================================
+ Hits 7573 7575 +2
Misses 96 96
+ Partials 454 448 -6
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary
Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. Adds a `toBlockNumber` helper that coerces block heights and event indices to non-negative integers (or null), and threads it through `formatAccountEvent`, `formatAccountActivity`, `buildAccountSummary`, and `formatAccountDay`. The implementation is correct — null/undefined, NaN, ±Infinity, and negative values all become null; valid non-negative values are truncated to integer. Test coverage is targeted and meaningful, exercising every changed call site with representative bad inputs. Nits (4)
🟩 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.
|
Summary
Closes #2187
Sanitize block heights and event indices across the account API builders so negative or non-finite values never leak into summary, activity, history, or event payloads.
What Changed
Registry Safety
Validation
Focused tests (not run locally — no Node 22 in this environment):