Repository navigation
fix(sof): neutralise formula-like CSV header cells as data cells are - #2957
Open
angela-helios wants to merge 1 commit into
Open
angela-helios wants to merge 1 commit into
angela-helios wants to merge 1 commit into
Conversation
CSV data cells went through neutralize_csv_formula, but every header row was written raw, so an author's column named =HYPERLINK(...) reached other users' spreadsheets as a formula. The three helios-sof header writes and HFS's in-memory export header now neutralise the names; the latter also quotes them. Closes #2956
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2956
Summary
CSV data cells went through
neutralize_csv_formula, but every header row was written raw. A ViewDefinition or Library author controls the column names, so a column named=HYPERLINK(...)reached other users' spreadsheets as a live formula.helios_sof::csv_header_cells(columns)neutralises each name as a string cell is. The three header writes inhelios-sofuse it:format_csv,write_csv_header, and the streaming row writer's first record. Thecsvcrate quotes the cells as before.crates/rest/src/export/in_memory.rsroutes its header through its owncsv_cell. That neutralises the names and also quotes them: before, the names were joined with,unquoted, so a column namedb,cshifted every column after it.Tests
helios-sof:every_csv_header_writer_neutralizes_formula_column_names. The bufferedformat_csvheader and the streamingwrite_csv_headerboth write"'=HYPERLINK(""x"")",b,'@c.helios-rest:view_and_query_csv_writers_agree_on_formula_column_names. The in-memory view writer writes'=1+2,"b,c"and matcheshelios_sof::format_csvbyte for byte.With the header neutralisation removed and the old REST header restored, both tests fail; with the fix they pass. The CSV tests in
helios-sof(6) and theexport::in_memorytests inhelios-rest(44) pass. Clippy on both crates (--lib --tests) is clean.