Skip to content

fix(detectors): Fix bug with empty string and keyword in SQL Injection Detector #93071

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 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"method": "GET",
"query_string": [
["username", "hello"],
["sort", "username"]
["sort", "username"],
["empty", ""],
["single", "u"]
]
},
"spans": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ def extract_request_data(self, event: dict[str, Any]) -> None:
query_value = query_pair[1]
query_key = query_pair[0]

if not isinstance(query_value, str):
# Filters out empty strings or single character strings
if (
not isinstance(query_value, str)
or not isinstance(query_key, str)
or not query_value
or len(query_value) == 1
):
continue
if query_key == query_value:
continue
if query_value.upper() in SQL_KEYWORDS:
if query_value.upper() in SQL_KEYWORDS or query_key.upper() in SQL_KEYWORDS:
continue
valid_parameters.append(query_pair)

Expand Down
Loading