Skip to content

[DataGridPremium] Escape singleSelect values in Excel export with escapeFormulas enabled#22851

Merged
michelengelen merged 5 commits into
mui:masterfrom
Anexus5919:fix/excel-singleselect-formula-escape
Jun 26, 2026
Merged

[DataGridPremium] Escape singleSelect values in Excel export with escapeFormulas enabled#22851
michelengelen merged 5 commits into
mui:masterfrom
Anexus5919:fix/excel-singleselect-formula-escape

Conversation

@Anexus5919

Copy link
Copy Markdown
Contributor

Changelog

The Excel exporter applies the escapeFormulas guard (on by default) only to string values held in the local cellValue. The singleSelect branch of serializeRowUnsafe wrote the formatted label straight to the serialized row and never set cellValue, so a singleSelect label beginning with =, +, -, @, tab or carriage return was exported without the neutralizing apostrophe (OWASP CSV/Excel formula injection), while the CSV exporter and the other column types escaped it correctly.

This routes the singleSelect label through cellValue so it flows through the shared escape guard. Adds tests asserting a singleSelect formula label is escaped when escapeFormulas is enabled (default) and left untouched when it is disabled.

Closes #22819

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Anexus5919

Copy link
Copy Markdown
Contributor Author

@rita-codes @michelengelen Kindly have review on this pr. Thanks!

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22851--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium ▼-20B(0.00%) ▼-3B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@zannager zannager added the scope: data grid Changes related to the data grid. label Jun 22, 2026
@michelengelen michelengelen added feature: Export type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Jun 25, 2026

@michelengelen michelengelen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but I would like to wait for a second review from the core datagrid team (especially @cherniavskii) since they have the most experience with this code section

@Anexus5919

Copy link
Copy Markdown
Contributor Author

Sure.

@arminmeh arminmeh added the CLA: signed Head to https://mui-org.notion.site/92ece655b1584b10b00e4de9e67eed. label Jun 26, 2026
@arminmeh arminmeh changed the title [data grid] Escape singleSelect formulas in Excel export [DataGridPremium] Escape singleSelect values in Excel export with escapeFormulas enabled Jun 26, 2026
@arminmeh arminmeh added needs cherry-pick The PR should be cherry-picked to master after merge. v8.x labels Jun 26, 2026
@michelengelen
michelengelen merged commit 6dec017 into mui:master Jun 26, 2026
21 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Cherry-pick PRs will be created targeting branches: v8.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA: signed Head to https://mui-org.notion.site/92ece655b1584b10b00e4de9e67eed. feature: Export needs cherry-pick The PR should be cherry-picked to master after merge. scope: data grid Changes related to the data grid. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[data grid] Excel export bypasses escapeFormulas for singleSelect columns

4 participants