Skip to content

Add OutputFilter::escapeCsvFormula#88

Open
arib06 wants to merge 1 commit into
joomla-framework:4.x-devfrom
arib06:csv-formula-escaping
Open

Add OutputFilter::escapeCsvFormula#88
arib06 wants to merge 1 commit into
joomla-framework:4.x-devfrom
arib06:csv-formula-escaping

Conversation

@arib06

@arib06 arib06 commented Jul 20, 2026

Copy link
Copy Markdown

Adds a shared escapeCsvFormula() method to OutputFilter.

A value beginning with =, +, - or @ that is written into a CSV file is evaluated as a formula when the file is opened directly in a spreadsheet application (CSV formula injection, CWE-1236). Prepending a space keeps the value inert while leaving it readable.

The CMS currently implements this twice, in ActionlogsHelper and (pending in joomla/joomla-cms#48047) in the banner tracks export. Per the discussion on that PR the shared implementation belongs in the framework filter package rather than the CMS OutputFilter, so that the CMS can move both call sites onto it in 6.2 and third party extensions can use it too.

Unit tests covering the formula characters, an inner =, plain text and the empty string are included in Tests/OutputFilterTest.php.

Related: joomla/joomla-cms#48047

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.

1 participant