-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ruby): tighten sql injection patterns (#465)
- Loading branch information
Showing
4 changed files
with
116 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# bearer:expected ruby_rails_sql_injection | ||
User.where(username: "mish").count(params[:col]) | ||
|
||
# bearer:expected ruby_rails_sql_injection | ||
user.posts.count(params[:col]) | ||
|
||
# safe uses of shared method | ||
my_arr = [1, 2, 3, 2] | ||
# ok | ||
my_arr.count(params[:item]) | ||
|
||
ITEMS = [:apple, :carrot, "orange"] | ||
ITEMS.count | ||
ITEMS.count(:apple) | ||
|
||
# bearer:expected ruby_rails_sql_injection | ||
User.select("#{params[:oops]} AS oops") | ||
# bearer:expected ruby_rails_sql_injection | ||
user.posts.select("#{params[:oops]} AS oops") |