Skip to content

fix(frontend): neutralise spreadsheet formula injection in CSV export (#83) - #86

Merged
amar-python merged 1 commit into
mainfrom
fix/issue-83-csv-formula-injection
Oct 26, 2026
Merged

amar-python merged 1 commit into
mainfrom
fix/issue-83-csv-formula-injection

Conversation

@amar-python

Copy link
Copy Markdown
Owner

Fixes #83. Part of ART Milestone 1 (BR-35, export part).

Change

escapeCsv in csv-table-hub-main/src/lib/export.ts:

  • Prefixes values starting with =, +, -, @, tab or CR with ', per OWASP CSV-injection guidance.
  • Leaves plain signed numbers such as -5 and +3.2 untouched, so numeric report values keep their meaning.
  • Also quotes values containing CR, not just LF.

XLSX export is unaffected. SheetJS json_to_sheet writes strings as text cells, never formulas.

Evidence

  • npx vitest run: 8 files, 107 passed (102 before, plus 5 new).
  • With the fix reverted, the 4 formula-payload tests fail; the plain-numbers test passes either way, guarding against over-prefixing.
  • npx tsc --noEmit: exit 0.
  • ESLint errors on the two touched files: 20, the same as on main, so nothing new.

Generated by Claude Code

…#83)

escapeCsv now prefixes values starting with = + - @ tab or CR with a
quote (OWASP CSV injection), leaving plain signed numbers alone, and
quotes values containing CR. Error and audit report exports carry
user-supplied cells, so a payload like =HYPERLINK(...) no longer runs
when the export is opened in Excel. XLSX output is unaffected:
json_to_sheet stores strings as text cells, not formulas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
@amar-python amar-python added this to the ART extension milestone Oct 26, 2026 — with Claude
@amar-python amar-python added art ART framework extension work security Security labels Oct 26, 2026 — with Claude
@amar-python
amar-python merged commit 1348577 into main Oct 26, 2026
3 checks passed
amar-python pushed a commit that referenced this pull request Oct 26, 2026
Brings in #87, #90 and #86. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019YPoXzBSj89ZHgw7nfTmbB
@amar-python
amar-python deleted the fix/issue-83-csv-formula-injection branch October 27, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

art ART framework extension work security Security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F3: CSV export does not neutralise spreadsheet formula injection

2 participants