fix(core): Apply dataCollection.databaseQueryData to inline SQL literals - #24089
Draft
s1gr1d wants to merge 1 commit into
Draft
fix(core): Apply dataCollection.databaseQueryData to inline SQL literals#24089s1gr1d wants to merge 1 commit into
dataCollection.databaseQueryData to inline SQL literals#24089s1gr1d wants to merge 1 commit into
Conversation
…erals Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
Comment on lines
+19
to
+21
| filterCollectedDbQueryText, | ||
| flushIfServerless, | ||
| } from '@sentry/core/server'; |
There was a problem hiding this comment.
Nuxt DB breadcrumbs and static span names bypass databaseQueryData redaction
Nuxt's database instrumentation filters only the db.query.text span attribute; successful queries still place the raw SQL in breadcrumb fields and use it as the span name when span streaming is disabled. Inline literals derived from caller or request data can therefore be sent despite dataCollection.databaseQueryData: false; apply the helper to the breadcrumb and non-streaming span-name paths.
Evidence
createBreadcrumb()passes the unfilteredqueryto bothmessageanddata['db.query.text'];addBreadcrumb()stores these values on the current isolation scope for subsequent events.- In
createStartSpanOptions(), the non-streaming branch setsnamedirectly toquery, while only thedb.query.textattribute usesfilterCollectedDbQueryText. - Nuxt's production database plugins invoke this instrumentation for configured Nitro databases, and
db.execplus prepared-statement methods accept statements containing inline literals. - No central breadcrumb or span-name filtering applies
databaseQueryData, so a successful query followed by an error event or a static transaction can expose the raw literal.
Identified by Warden · security-review · ZWT-URM
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.
dataCollection.databaseQueryData: falsedid nothing outside Supabase. mysql, mysql2, postgres, tedious, knex, the Nuxt DB helper and Cloudflare D1 all wrote the raw statement todb.query.text, so inline literals likeWHERE email = 'jane@example.com'shipped either way. Most of them already computed a sanitized copy fordb.query.summaryand then ignored it.The new
filterCollectedDbQueryTexthelper in@sentry/core/serverkeeps the raw statement by default and swaps in the sanitized one when the option is off. The spec exempts sanitized statements, so dropping the attribute would cost more than it protects.Fixes #24084