Skip to content

ROU-12261: adding protection against CSV injection attacks#490

Merged
gnbm merged 7 commits intodevfrom
ROU-12261
Feb 27, 2026
Merged

ROU-12261: adding protection against CSV injection attacks#490
gnbm merged 7 commits intodevfrom
ROU-12261

Conversation

@rugoncalves
Copy link
Contributor

@rugoncalves rugoncalves commented Feb 25, 2026

This PR is for adding protection against CSV injection attacks when exporting data from the Wijmo DataGrid by escaping dangerous cell values. The main change is the introduction of a method to sanitize cell values that start with characters commonly used in spreadsheet formulas, and hooking this logic into the grid's CSV export process.

What was happening

  • The component was susceptible to CSV injection attacks, by not escaping dangerous cell values, leaving the end user unprotected.

What was done

  • Added a feature named CellValueSanitization
  • This new feature has a public method escapeCsvInjection* to sanitize cell values that could trigger CSV injection by prefixing dangerous values with a single quote and handling edge cases with quotes and line breaks.
  • Registered a handler in the build method to apply escapeCsvInjection to each cell value during CSV export using Wijmo's gettingCellClipString event**.
  • Added a _dangerousStarts array listing characters that can trigger CSV injection (=, +, -, @).

*The method was made public to allow unit-tests to be added in the future.
**Added in the Wijmo 2025 v2 release. This handler is invoked when wijmo is obtaining the cell values to export.

Test Steps

  1. Go to the test page
  2. Paste the following values on the first column:
    • =1+2
    • =HYPERLINK("https://evil.com","Click here")
    • +HYPERLINK("https://evil.com","Click here")
    • -1+1
    • "=IMAGE("https://evil.com/1x1.png")
    • @SUM(A1:A10)
  3. Export to CSV
  4. Validate that the values are escaped (see screenshot below)

Screenshots

image

Checklist

  • tested locally
  • documented the code
  • clean all warnings and errors of eslint
  • requires changes in OutSystems (if so, provide a module with changes)
  • requires new sample page in OutSystems (if so, provide a module with changes)

Copilot AI review requested due to automatic review settings February 25, 2026 14:32
@rugoncalves rugoncalves requested a review from a team as a code owner February 25, 2026 14:32
@rugoncalves rugoncalves added enhancement New feature or request chore labels Feb 25, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds CSV injection attack protection to the Wijmo DataGrid export functionality by implementing cell value sanitization during CSV export operations. The protection prevents malicious formulas from being executed when exported CSV files are opened in spreadsheet applications like Excel, LibreOffice, or Google Sheets.

Changes:

  • Added a CSV injection escape method that sanitizes dangerous cell values by prefixing them with a single quote
  • Integrated the sanitization logic with Wijmo's gettingCellClipString event to automatically protect all CSV export operations
  • Fixed a typo in variable naming from _curPage to _currPage for consistency with codebase conventions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

rugoncalves and others added 5 commits February 25, 2026 15:41
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link

@gnbm gnbm merged commit f70ea34 into dev Feb 27, 2026
13 checks passed
@gnbm gnbm deleted the ROU-12261 branch February 27, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants