Neutralize formula injection in the legacy admin list export by ManoharPaturi · Pull Request #43084 · PrestaShop/PrestaShop · GitHub
Skip to content

Neutralize formula injection in the legacy admin list export - #43084

Open
ManoharPaturi wants to merge 1 commit into
PrestaShop:developfrom
ManoharPaturi:sanitize-legacy-list-export
Open

ManoharPaturi wants to merge 1 commit into
PrestaShop:developfrom
ManoharPaturi:sanitize-legacy-list-export

Conversation

@ManoharPaturi

@ManoharPaturi ManoharPaturi commented Oct 4, 2026 •

Copy link
Copy Markdown
Questions Answers
Branch? develop
Description? See below
Type? improvement
Category? BO
BC breaks? no
Deprecations? no
How to test? See below
UI Tests This change does not touch any interface, so no UI test campaign was run.
Fixed issue or discussion? #43089
Related PRs
Sponsor company

Description

The legacy admin list export (AdminController::processExport() to the CSV writer) writes field values without inspecting the content, so a list field beginning with =, +, -, @, a tab or a carriage return becomes a formula when the exported CSV is opened in a spreadsheet application, the same CSV injection pattern already handled in newer export paths.

This change neutralizes those leading characters in the legacy export path as well, so every admin list CSV export is consistent with the protection the project already applies elsewhere.

How to test

Add a product (or any list entity) whose name begins with =SUM(1+1) and export the corresponding admin list as CSV. Open the file in a spreadsheet application: the cell shows the literal text. Exporting lists with ordinary values produces byte identical output to before.

Verified with php -l and by comparing export output before and after for a set of names with and without leading formula characters.

Fixes #43089

Copilot AI balanced review requested due to automatic review settings October 4, 2026 02:22
@ManoharPaturi
ManoharPaturi requested a review from a team as a code owner October 4, 2026 02:22
@ps-jarvis ps-jarvis added the Improvement Type: Improvement label Oct 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ps-jarvis

Copy link
Copy Markdown

Hello @ManoharPaturi!

This is your first pull request on PrestaShop repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@ManoharPaturi
ManoharPaturi changed the base branch from 9.2.x to develop October 4, 2026 02:33
@ManoharPaturi
ManoharPaturi requested a review from a team as a code owner October 4, 2026 02:33
@ps-jarvis ps-jarvis added Improvement Type: Improvement develop Branch and removed Improvement Type: Improvement labels Oct 4, 2026
AdminController::processExport writes the admin list to a CSV response
without inspecting the values, while the streamed exports already
neutralize values starting with =, +, -, @, a tab or a carriage return in
CsvResponse, and the module statistics export does the same in
ModuleGraph::escapeCell. A legacy controller that enables allow_export,
which module controllers still do, exports database text written by
customers, so the file handed to the employee can carry a formula that a
spreadsheet application executes on open.

The header row and every field value now go through the same policy as
the other export components.
@ManoharPaturi
ManoharPaturi force-pushed the sanitize-legacy-list-export branch from 9f1a498 to 2ab8860 Compare October 4, 2026 02:39
@ManoharPaturi

Copy link
Copy Markdown
Author

Thank you for the pointers. The pull request is now based on develop, the description table is filled in, and a matching issue has been opened and linked in the description. Please let me know if anything else is needed.

@Hlavtox Hlavtox 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.

Nonsense, formulas have nothing to do with CSV. CSV can be opened in a text editor.

@ps-jarvis ps-jarvis added the Waiting for author Status: action required, waiting for author feedback label Oct 6, 2026
@ManoharPaturi

Copy link
Copy Markdown
Author

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

Labels

develop Branch Improvement Type: Improvement Waiting for author Status: action required, waiting for author feedback

Projects

Status: Waiting for author

Development

Successfully merging this pull request may close these issues.

Legacy admin list export can carry spreadsheet formulas

4 participants