Skip to content

Better user errors #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ def index():
"SELECT * FROM books WHERE name LIKE '%" + name + "%'"
)
books = [Book(*row) for row in cursor]
if len(books) == 0:
return make_response(f"No search results for Name: {name}", 404)

Check warning

Code scanning / CodeQL

Reflected server-side cross-site scripting

Cross-site scripting vulnerability due to [a user-provided value](1).

elif author:
cursor.execute(
"SELECT * FROM books WHERE author LIKE '%" + author + "%'"
)
books = [Book(*row) for row in cursor]
if len(books) == 0:
return make_response(f"No search results for Author: {author}", 404)

Check warning

Code scanning / CodeQL

Reflected server-side cross-site scripting

Cross-site scripting vulnerability due to [a user-provided value](1). Cross-site scripting vulnerability due to [a user-provided value](2).

else:
cursor.execute("SELECT name, author, read FROM books")
Expand Down