Skip to content

fix(security): replace excel4node with write-excel-file to remove vulnerability - #1883

Merged
EnkiP merged 3 commits into
mainfrom
fix/excel4node-vulenrability
Sep 8, 2026
Merged

fix(security): replace excel4node with write-excel-file to remove vulnerability#1883
EnkiP merged 3 commits into
mainfrom
fix/excel4node-vulenrability

Conversation

@EnkiP

@EnkiP EnkiP commented Sep 7, 2026

Copy link
Copy Markdown
Member

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Replace excel4node with write-excel-file in xlsx export plugin

  • Replaces the excel4node dependency with write-excel-file to remove a security vulnerability in plugin-export-advanced
  • Rewrites the xlsx renderer to map records to write-excel-file cell descriptors, encoding booleans, numbers, and dates as typed cells
  • addExportAdvanced now awaits the renderer output before returning the file result
  • Risk: toCell in xlsx.ts now infers types, converting numeric strings to numbers and lowercase boolean strings to booleans, changing how some data is represented in exported spreadsheets

Changes since #1883 opened

  • Added validation in the toCell utility within plugin-export-advanced to convert non-finite numeric values (NaN, Infinity, -Infinity) to string cells instead of number cells, and to return null for invalid Date instances [dba86e3]
  • Changed the date format for XLSX date cells from 'yyyy-mm-dd hh:mm:ss' to 'm/d/yy' using a new XLSX_DATE_FORMAT constant [dba86e3]
  • Configured the writeXlsxFile function call in plugin-export-advanced to specify the worksheet name as 'Export' [dba86e3]

Macroscope summarized 5a6cf6e.

@qltysh

qltysh Bot commented Sep 7, 2026

Copy link
Copy Markdown

2 new issues

Tool Category Rule Count
qlty Structure Function with many returns (count = 9): toCell 1
qlty Structure Function with high complexity (count = 17): toCell 1

@qltysh

qltysh Bot commented Sep 7, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/plugin-export-advanced/src/index.ts100.0%
Coverage rating: A Coverage rating: A
packages/plugin-export-advanced/src/renderers/xlsx.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

…mitive branches

Export toCell and unit-test the cast paths qlty flagged as uncovered:
numeric string to Number, non-primitive to String, and the false
boolean-string branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

excel4node gone, security goal met. 5 findings in xlsx.ts, two are changes the description misses.

Comment thread packages/plugin-export-advanced/src/renderers/xlsx.ts Outdated
Comment thread packages/plugin-export-advanced/src/renderers/xlsx.ts Outdated
Comment thread packages/plugin-export-advanced/src/renderers/xlsx.ts Outdated
Comment thread packages/plugin-export-advanced/src/renderers/xlsx.ts Outdated
Comment thread packages/plugin-export-advanced/src/renderers/xlsx.ts Outdated
…ject non-finite values

Address review on the excel4node -> write-excel-file migration:
- name the worksheet 'Export' again (default was 'Sheet1', breaking Export!A1 refs)
- match excel4node's default 'm/d/yy' date format instead of yyyy-mm-dd hh:mm:ss
- send non-finite numbers and invalid dates as text/empty instead of shipping
  <v>NaN</v>/<v>Infinity</v>, which made Excel offer to repair the file
- guard numeric strings with Number.isFinite so 'Infinity'/'1e309' stay text
- extract the date format into a file-local constant

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EnkiP
EnkiP merged commit a9dbd1d into main Sep 8, 2026
38 checks passed
@EnkiP
EnkiP deleted the fix/excel4node-vulenrability branch September 8, 2026 13:19
forest-bot added a commit that referenced this pull request Sep 8, 2026
## @forestadmin/plugin-export-advanced [1.1.50](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/plugin-export-advanced@1.1.49...@forestadmin/plugin-export-advanced@1.1.50) (2026-09-08)

### Bug Fixes

* **security:** replace excel4node with write-excel-file to remove vulnerability ([#1883](#1883)) ([a9dbd1d](a9dbd1d))
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.

2 participants