Skip to content

fix: prevent object expansion in placeholders after SET clause#5

Merged
wellwelwel merged 1 commit into
mainfrom
where
Feb 5, 2026
Merged

fix: prevent object expansion in placeholders after SET clause#5
wellwelwel merged 1 commit into
mainfrom
where

Conversation

@wellwelwel
Copy link
Copy Markdown
Member

@wellwelwel wellwelwel commented Feb 5, 2026

Fixes object expansion in placeholders positioned after the SET clause (e.g. WHERE, subqueries) by resetting setIndex after the first object is expanded, so only the SET ? placeholder uses objectToValues.


Before:

format('UPDATE users SET ? WHERE id = ?', [{ name: 'foo' }, { id: 1 }])
UPDATE users SET `name` = 'foo' WHERE id = `id` = 1
--                                         ^^^^^^^^^ 
--                                         expands to key=value (vulnerable)

After:

format('UPDATE users SET ? WHERE id = ?', [{ name: 'foo' }, { id: 1 }])
UPDATE users SET `name` = 'foo' WHERE id = '[object Object]'
--                                         ^^^^^^^^^^^^^^^^^
--                                         safely stringified

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (968d07e) to head (6174853).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #5   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          361       362    +1     
=========================================
+ Hits           361       362    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wellwelwel wellwelwel marked this pull request as ready for review February 5, 2026 03:07
@wellwelwel wellwelwel merged commit 557bd7f into main Feb 5, 2026
13 checks passed
@wellwelwel wellwelwel deleted the where branch February 5, 2026 03:09
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