Conversation
Contributor
There was a problem hiding this comment.
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
gettingCellClipStringevent to automatically protect all CSV export operations - Fixed a typo in variable naming from
_curPageto_currPagefor consistency with codebase conventions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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>
|
OS-giulianasilva
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
What was done
CellValueSanitizationescapeCsvInjection* 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.buildmethod to applyescapeCsvInjectionto each cell value during CSV export using Wijmo'sgettingCellClipStringevent**._dangerousStartsarray 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+2=HYPERLINK("https://evil.com","Click here")+HYPERLINK("https://evil.com","Click here")-1+1"=IMAGE("https://evil.com/1x1.png")@SUM(A1:A10)Screenshots
Checklist