-
Notifications
You must be signed in to change notification settings - Fork 64
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
[IMP] Prevent SQL Injections #27
Conversation
Thanks! Apologies for not being aware of this. |
My bad too, I should have told you sooner, but you're too fast for me :D Also, small fix is coming |
Sorry, too much time on my hands due to COVID-19 :P |
@@ -112,18 +112,18 @@ def end_creation(user, channel, message_id): | |||
|
|||
|
|||
def exists(message_id): | |||
db.execute(f"SELECT * FROM messages WHERE message_id = '{message_id}';") | |||
db.execute("SELECT * FROM messages WHERE message_id = ?;", (message_id,)) |
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.
Do the commas after, for example, message_id
serve a purpose or can I delete them? I do not see examples in the sqlite3 library using trailing commas.
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.
Yes, it's for forcing tuples
@@ -34,7 +34,7 @@ def _generate_reactionrole_id(self): | |||
while True: |
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.
By the way, this is not the proper way to proceed, that why we use Primary Keys
I think I will not have time to do another PR soon, so here's a more few remarks if you have time.
I suggest you to read This guide, it will explain better than me :) |
Thanks, I will study it this week. I barely ever worked with SQL queries beforehand, sorry! |
No need for excuses, I just wanted to give you some insights :) |
Using python formatting to build SQL instructions is very insecure.
Also added .db files in
.gitignore