Skip to content

fix(security): sanitize CSV export to prevent formula injection - #293

Merged
jjaquish merged 1 commit into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-49853
Aug 10, 2026
Merged

jjaquish merged 1 commit into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-49853

Conversation

@platex-rehor-bot

@platex-rehor-bot platex-rehor-bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Description

Sanitize CSV export data in the ExportsDropdown component to prevent spreadsheet formula injection (CSV injection / DDE injection). Values starting with formula trigger characters (=, +, -, @, TAB, CR) are now prefixed with a single quote so spreadsheets treat them as literal text instead of formulas.

RHCLOUD-49853


Screenshots

No UI changes — pure logic fix.


Anything reviewers should know?

  • The sanitizeCsvValue utility prefixes dangerous values with a single quote ('), which is the standard OWASP-recommended approach for CSV formula neutralization. The quote is visible in the raw CSV but is silently consumed by Excel/LibreOffice as a "text prefix" indicator.
  • The sanitization is applied via useMemo keyed on payloads for performance — no re-computation on unrelated re-renders.
  • react-csv@1.1.2 (currently pinned) does not perform any formula neutralization itself; it only applies CSV quoting.
  • Affected fields from the API: status_msg, service, source — any free-text field that a tenant could control.

Checklist

  • Accessibility: color contrast, keyboard nav, screen reader tested (or N/A)
  • All PR checks pass locally (build, lint, test)
  • No unrelated changes included
  • (Optional) QE: OUIA changed, test impact, no coverage
  • (Optional) UX: end-user UX modified, designs need sign-off

AI disclosure

Assisted by: Claude Code

RHCLOUD-49853
Neutralize spreadsheet formula injection in CSV exports by prefixing
values starting with =, +, -, @, TAB, or CR with a single quote.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@platex-rehor-bot
platex-rehor-bot requested a review from a team as a code owner August 5, 2026 17:44

@jjaquish jjaquish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jjaquish
jjaquish merged commit f2b7a39 into RedHatInsights:master Aug 10, 2026
7 checks passed
@platex-rehor-bot
platex-rehor-bot deleted the bot/RHCLOUD-49853 branch August 10, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants