Skip to content

Node week 2#279

Draft
magdazelena wants to merge 1 commit intomainfrom
275/node-updates-week2
Draft

Node week 2#279
magdazelena wants to merge 1 commit intomainfrom
275/node-updates-week2

Conversation

@magdazelena
Copy link
Contributor

Reference: #275

Comment on lines +123 to +125
- Show how interpolating raw user input into SQL (for example, using `.raw()` or `orderByRaw(req.query.sort)`) can open up injection vulnerabilities.
- Use a Snippets-style example, such as an endpoint that sorts results based on a `sort` query parameter, to demonstrate how a malicious value could modify the query.
- Contrast this with safe usage of the Knex Query Builder and parameter binding.

Choose a reason for hiding this comment

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

should we consider adding the SQL Injection snippet for the actual demonstration of how the data would be affected if used incorrectly? It probably could be a nice addition to show what exactly happens if such thing is executed (sorry if it was written somewhere and I missed it). Considering that it is the orderByRaw it is a Blind SQL Injection as far as I know, so it is not the easiest one to reproduce yourself if you do not know where to look at. Maybe something like this could suffice
(CASE WHEN (SELECT COUNT(*) FROM users WHERE email='admin@test.com') > 0 THEN email ELSE password END)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants