-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Add validation for invalid date query parameter values #3330
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -257,3 +257,18 @@ suite.test('cannot pass non-string values to query as text', (done) => { | |||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
if (!helper.args.native) { | ||||||||||||||||||||||||||||||
suite.test('when a query has an invalid date binding', function (done) { | ||||||||||||||||||||||||||||||
var client = createErorrClient() | ||||||||||||||||||||||||||||||
var calledDone = false | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
client.query(new pg.Query({ text: 'SELECT $1::timestamp', values: [new Date(undefined)] }), function (err, res) { | ||||||||||||||||||||||||||||||
if (!calledDone) { | ||||||||||||||||||||||||||||||
calledDone = true | ||||||||||||||||||||||||||||||
assert.equal(err.message, 'Query parameter value cannot be an invalid date.') | ||||||||||||||||||||||||||||||
client.end(done) | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
Comment on lines
+264
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will cause this error, as the connection also gets terminated, and the callback will be executed again.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That’s a serious bug, then. |
||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens in the 'native' case?