Skip to content

Commit 48b1200

Browse files
committed
Add test
1 parent 8e9174d commit 48b1200

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/aikido/zen/scanners/sql_injection_scanner_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@ def refute_attack(query, input = query, *args)
254254
refute_attack "SELECT * FROM users", "1,2,3"
255255
end
256256

257+
test "it flags regular expression matching timeouts as attacks" do
258+
timeout = Regexp.timeout
259+
Regexp.timeout = 0.01
260+
261+
refute_attack "SELECT * FROM users WHERE id IN (123,)", "123,"
262+
263+
input = "1," * 1 * 1024 * 1024
264+
265+
assert_attack "SELECT * FROM users WHERE id IN (#{input})", input
266+
ensure
267+
Regexp.timeout = timeout
268+
end
269+
257270
test "attacks are not prevented if libzen can't be loaded" do
258271
assert_attack "SELECT * FROM users WHERE id = '' OR true; --'", "' OR true; --'"
259272

0 commit comments

Comments
 (0)