Skip to content

Trim user input before sending to detect_sql_injection#645

Merged
bitterpanda63 merged 1 commit into
mainfrom
fix/trim-user-input-sql-injection
Jun 1, 2026
Merged

Trim user input before sending to detect_sql_injection#645
bitterpanda63 merged 1 commit into
mainfrom
fix/trim-user-input-sql-injection

Conversation

@bitterpanda63
Copy link
Copy Markdown
Member

@bitterpanda63 bitterpanda63 commented Jun 1, 2026

Strips leading/trailing whitespace from user input before SQL injection detection, matching the fix applied to the Java firewall in AikidoSec/firewall-java#298.

Problem: An attacker can pad their payload with trailing whitespace (e.g. "payload "). If the DB driver trims this before execution, the SQL query won't contain the padded input, causing should_return_early to incorrectly return True (missed detection).

Fix: Apply .lower().strip() to the user input before both the early-return check and the native detection call.

See: AikidoSec/firewall-java#298

Summary by Aikido

Security Issues: 0 Quality Issues: 0 Resolved Issues: 0

🐛 Bugfixes

  • Trimmed and lowercased user input before SQL injection detection

More info

@bitterpanda63 bitterpanda63 merged commit 3734f28 into main Jun 1, 2026
155 of 157 checks passed
@bitterpanda63 bitterpanda63 deleted the fix/trim-user-input-sql-injection branch June 1, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants