Skip to content
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

document (lack of?) risk of SQL injection #229

Closed
astraw opened this issue Feb 29, 2016 · 4 comments
Closed

document (lack of?) risk of SQL injection #229

astraw opened this issue Feb 29, 2016 · 4 comments

Comments

@astraw
Copy link

astraw commented Feb 29, 2016

Does diesel automatically escape variables to prevent SQL injection attacks?

I see escape_identifier for the postgres RawConnection and indeed I was apparently unable to hijack my diesel-based interactions with Postgres. That said, I'm not a seasoned attacker, nor did I try with sqlite.

I also found a quote claiming that SQL injection attacks are stopped.

Either way, it would be helpful to discuss what measures are taken by diesel and what measures should be taken by the user to prevent SQL injection attacks.

@sgrif
Copy link
Member

sgrif commented Mar 3, 2016

Does diesel automatically escape variables to prevent SQL injection attacks?

Yes.

Either way, it would be helpful to discuss what measures are taken by diesel

I'm not sure we should go too in depth here. Protection from SQL injection attacks is pretty much an assumed feature of any ORM.

what measures should be taken by the user to prevent SQL injection attacks.

None

@sgrif
Copy link
Member

sgrif commented Mar 5, 2016

Going to close this issue. Please do comment if you still think that there is something actionable to be done here.

@sgrif sgrif closed this as completed Mar 5, 2016
@astraw
Copy link
Author

astraw commented Mar 6, 2016

Well given the quote We achieve this by having Diesel eliminate the possibility of incorrect database interactions at compile time it wasn't clear to me that Diesel was doing runtime checking on top of compile time checks. So, sure, traditional ORMs should stop injection attacks, but Diesel is very different from ORMs I've used.

I do think that some documentation (one sentence) somewhere saying that SQL injection is stopped via escaping identifiers at runtime would be useful.

@sgrif
Copy link
Member

sgrif commented Mar 6, 2016

Again, I think that escaping identifiers and strings (or using prepared statements, which is what we do) would be assumed of all ORMs, but feel free to open a PR and we can discuss the specific changes you'd like to make to the docs.

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

No branches or pull requests

2 participants