fix(ui): guard leading tab and CR in escapeCsvCell against formula injection#7468
Conversation
…jection escapeCsvCell only prefixed the anti-formula "'" when a value started with =, +, -, or @. A spreadsheet strips a leading TAB (\t) or CR (\r) and still evaluates the formula that follows, so a telemetry-sourced value like "\t=HYPERLINK(...)" slipped past the guard unescaped. Extend the guard regex to /^[=+\-@\t\r]/ so a leading tab or CR is guarded the same way. Closes JSONbored#7439
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-20 13:56:43 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
escapeCsvCell(apps/loopover-ui/src/lib/csv-export.ts) guards spreadsheet formula-injection by prefixing'when a value starts with=,+,-, or@. But a leading TAB (\t) or CR (\r) is also a formula-injection vector: a spreadsheet strips the leading whitespace and still evaluates the=/+/-/@formula that follows, so a telemetry-sourced value like"\t=HYPERLINK(\"evil\")"slipped past the guard unescaped.Fix
Extend the guard regex from
/^[=+\-@]/to/^[=+\-@\t\r]/, so a leading tab or CR is guarded the same way. No other behavior changes — RFC-4180 quoting is unchanged (a\rvalue still additionally quotes as before).Verification
csv-export.test.tsgains a#7439case asserting"\t=1+1"→"'\t=1+1","\t@SUM(A1)"→"'\t@SUM(A1)","\r=1+1"→ quoted-and-guarded, and that a plain value is untouched. All 7 csv-export tests pass.Closes #7439