-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ruby rule): add rails render to path rule (#656)
* fix: name of rails redirect rule * feat: add rails render to ruby path rule
- Loading branch information
Showing
12 changed files
with
76 additions
and
41 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
33 changes: 33 additions & 0 deletions
33
...by/lang/path_using_user_input/.snapshots/TestRubyLangPathUsingUserInput--unsafe_rails.yml
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,33 @@ | ||
low: | ||
- rule: | ||
cwe_ids: | ||
- "22" | ||
id: ruby_lang_path_using_user_input | ||
description: Do not use user input to form file paths. | ||
documentation_url: https://docs.bearer.com/reference/rules/ruby_lang_path_using_user_input | ||
line_number: 1 | ||
filename: unsafe_rails.rb | ||
parent_line_number: 1 | ||
parent_content: Rails.root.join(params[:oops]) | ||
- rule: | ||
cwe_ids: | ||
- "22" | ||
id: ruby_lang_path_using_user_input | ||
description: Do not use user input to form file paths. | ||
documentation_url: https://docs.bearer.com/reference/rules/ruby_lang_path_using_user_input | ||
line_number: 3 | ||
filename: unsafe_rails.rb | ||
parent_line_number: 3 | ||
parent_content: 'render(partial: params[:oops])' | ||
- rule: | ||
cwe_ids: | ||
- "22" | ||
id: ruby_lang_path_using_user_input | ||
description: Do not use user input to form file paths. | ||
documentation_url: https://docs.bearer.com/reference/rules/ruby_lang_path_using_user_input | ||
line_number: 4 | ||
filename: unsafe_rails.rb | ||
parent_line_number: 4 | ||
parent_content: 'render_to_string({ file: "/templates/#{params[:oops]}" })' | ||
|
||
|
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 |
---|---|---|
|
@@ -17,5 +17,3 @@ | |
path + params[:two] | ||
path / params[:three] | ||
path.join("a", params[:four]) | ||
|
||
Rails.root.join(params[:oops]) |
4 changes: 4 additions & 0 deletions
4
pkg/commands/process/settings/rules/ruby/lang/path_using_user_input/testdata/unsafe_rails.rb
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,4 @@ | ||
Rails.root.join(params[:oops]) | ||
|
||
render(partial: params[:oops]) | ||
render_to_string({ file: "/templates/#{params[:oops]}" }) |
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