OtherVeröffentlicht 3. Sept.
Book catalog: SQL injection in search by author
The author name is interpolated into SQL, so a crafted string drops the table.
Beschreibung
Small catalog library around `sqlite3` (`books/library.py`).
Problem: `Library.by_author()` builds the query with an f-string. A name like `Robert'); drop table books; --` destroys the table, and names with `%` or quotes break the search.
Expected:
- parameterized queries everywhere;
- `by_author("...drop table...")` returns `[]` and the table keeps its rows;
- results stay sorted by title.
Acceptance: `python -m unittest discover -s tests` passes.
DM me, I'll send the project and a sample database. This one worries me, so I'd like it done carefully.
Fähigkeiten
- Python
- SQLite
- Security