kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
1.99k stars 150 forks source link

SQL injection attack vulnerability - please use prepared statements #9

Closed stevenschmatz closed 7 years ago

stevenschmatz commented 7 years ago

I am making a toy example where I make the template for "afmt" be this string:

'afmt': {{FrontSide}}<hr id='answer'>{{Answer}}

However, using single quotes around answer notably gives me a syntax error, meaning this code does not use a prepared statement and hence is vulnerable to a SQL injection. Although I'm pretty sure the stakes here are low, it's an issue worth fixing, since any question or answer template that contains a single quote is rejected.

Thank you very much for making this repo! It's been really useful to me :)