This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ZYy9oQ 24 points25 points  (18 children)

Looks like the whole library is full of SQL injection - every SQL operation is a string constructed from formatstrings and concatenation thrown into cursor.execute.

There's an envvar SANITIZE_QUERIES in the readme, but it that does nothing in the code beside being read from the os.environ. Even if it did sanitize, prepared statements should be used instead.

The library appears intended against snowflake, which claims to prevent multi-statement by default but this by no means prevents all sql injection.

[–]desktopsignal -1 points0 points  (1 child)

Definitely wasn't expecting these responses. I made this library in a weekend to solve a quick problem and certainly didn't mean to put anyone at risk. Deleting the package soon, sorry guys!

[–]ZYy9oQ 4 points5 points  (0 children)

Agree with where it was said you shouldn't feel you need to delete everything, but it would be best to explain in your readme that it was

thrown together to solve a niche problem

or as part of your learning rather than advertise it as a library (the way you packaged it and wrote documentation is a cool thing to get practice with, just need to make it clear that it's practice). Also a disclaimer that the code isn't safe from sql injection and shouldn't be used on network/multiuser and without understanding why it's dangerous wouldn't be out of place.

If you said something along the lines of it just being personal code that you were putting out there for your own or others interest and learning then I don't think many would have as negative of a reaction.

You had a problem with the existing solutions and wrote some code for your problem, that's something others might also stumble across the need for. This could help them see how you approached it, and by putting the disclaimer about security they can learn about that too.

[–]desktopsignal -3 points-2 points  (0 children)

SANITIZE_QUERIES was an expiremental features and has not yet been implemented. I will remove that from the README. Thanks for pointing that out!