Skip to content

Commit b95ccea

Browse files
committed
Fix security vulnerability
1 parent 2099e5d commit b95ccea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def index():
1313

1414
if name:
1515
cursor.execute(
16-
"SELECT * FROM books WHERE name LIKE '%" + name + "%'"
16+
"SELECT * FROM books WHERE name LIKE :name", {'name': f"%{name}%"}
1717
)
1818
books = [Book(*row) for row in cursor]
1919

2020
elif author:
2121
cursor.execute(
22-
"SELECT * FROM books WHERE author LIKE '%" + author + "%'"
22+
"SELECT * FROM books WHERE author LIKE :author", {'author': f"%{author}%"}
2323
)
2424
books = [Book(*row) for row in cursor]
2525

0 commit comments

Comments
 (0)