Measurement Labels Execute as Spreadsheet Formulas in CSV Exports
Level 2 · node · Security · Missing spreadsheet formula neutralization in CSV exports
Scenario
A fictional laboratory history service exports operator-supplied equipment labels and readings to site-specific CSV files. Labels may contain commas and quotes, and CSV quoting is already applied. However, a label beginning with a formula marker may be interpreted as a spreadsheet expression instead of plain text. Review the repository, export service, and controller.
Requirements
Ensure exported user-supplied labels remain plain text when a CSV file is opened in a spreadsheet, including formula markers after leading whitespace. Preserve CSV quoting, numeric readings, site isolation, and invalid input rejection.
Acceptance criteria
- Ordinary measurement labels and numeric readings export as CSV.
- A label beginning with = is exported as text rather than an executable spreadsheet formula.
- Labels beginning with + or - are protected from formula interpretation.
- A formula marker following leading whitespace is also protected.
- Labels with commas and quotation marks remain valid CSV.
- CSV exports for one site exclude records from other sites.
- Invalid readings are not stored.