Skip to content

Conversation

kibertoad
Copy link
Collaborator

No description provided.

@kibertoad kibertoad requested a review from elhigu August 4, 2019 10:10
@@ -207,7 +207,15 @@ Object.assign(Client_MSSQL.prototype, {
},

wrapIdentifierImpl(value) {
return value !== '*' ? `[${value.replace(/\[/g, '[')}]` : '*';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.replace(/\[/g, '[')}] path was removed because it doesn't seem to do anything. Please correct me if that's wrong.

@kibertoad kibertoad requested a review from tgriesser August 4, 2019 10:12
.toSQL();
console.log(sql);
expect(sql.sql).to.equal(
'select * from [projects] where "id] = 1 UNION SELECT 1, @@version -- --" = ?'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like this to be verified with integration test + to test identifier that has both " and [] chars in it.

Copy link
Member

@elhigu elhigu Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I had no idea that mssql supports " quoting for identifiers.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[] are illegal symbols as per MSSQL documentation, apparently, so we don't need to test that. As advised by snyk people, I replaced our escaping logic with the one that sequelize uses, which removes [] in the first place.
And MSSQL does not support arrays.

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.

2 participants