Skip to content

Conversation

@roggenkemper
Copy link
Member

@roggenkemper roggenkemper commented Jun 6, 2025

adds a few additional checks to the sql injection detector:

  1. adds a check for an empty string
  2. checks if the key is a SQL keyword, now that we are checking if the key is also in the description.
  3. checks if the value is 1 character - can cause false positives if it's a single letter or number

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 6, 2025
@roggenkemper roggenkemper changed the title fix(detectors): Fix bug with empty string in SQL Injection Detector fix(detectors): Fix bug with empty string and keyword in SQL Injection Detector Jun 6, 2025
@roggenkemper roggenkemper marked this pull request as ready for review June 6, 2025 22:05
@roggenkemper roggenkemper requested a review from a team June 6, 2025 22:05
@roggenkemper roggenkemper requested a review from a team as a code owner June 6, 2025 22:05
Copy link
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for customizing the detection, but since this is a prototype no need to block 👍 my philosophy was to just replace all hard-coded numbers/limits with settings when possible, but if this is unnecessary feel free to ignore

not isinstance(query_value, str)
or not isinstance(query_key, str)
or not query_value
or len(query_value) == 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having a minimum match? I could see false positives for queries like "es" as well. You could add it as a detector setting as well and then customers could tweak the detection

e.g.

len(query_value) < self.settings.get("minimum_match_length")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense , will do it in a diff PR!

@roggenkemper roggenkemper merged commit 50984dd into master Jun 9, 2025
61 checks passed
@roggenkemper roggenkemper deleted the roggenkemper/sqlinjectionfix2 branch June 9, 2025 15:15
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants