-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Pass entirety of query parameters to search (in anticipation of implementing more querying functionality) - Move to a more OO-y rather than "callable" structure for the class and move parameters into object attributes - Add general `permit` of params to Brakeman ignore file
- Loading branch information
Showing
5 changed files
with
71 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
class SearchesController < ApplicationController | ||
def show | ||
result_set = DiscoveryEngine::Search.new.call( | ||
query_params[:q], | ||
start: query_params[:start]&.to_i, | ||
count: query_params[:count]&.to_i, | ||
) | ||
|
||
render json: result_set | ||
render json: DiscoveryEngine::Search.new(query_params).result_set | ||
end | ||
|
||
private | ||
|
||
def query_params | ||
params.permit(:q, :start, :count) | ||
params.permit! | ||
end | ||
end |
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,29 @@ | ||
{ | ||
"ignored_warnings": [ | ||
{ | ||
"warning_type": "Mass Assignment", | ||
"warning_code": 70, | ||
"fingerprint": "4c13d7998d2abdaad68d35c884f9a4527c1c3085beda87c99a93ada0eaef496e", | ||
"check_name": "MassAssignment", | ||
"message": "Specify exact keys allowed for mass assignment instead of using `permit!` which allows any keys", | ||
"file": "app/controllers/searches_controller.rb", | ||
"line": 9, | ||
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/", | ||
"code": "params.permit!", | ||
"render_path": null, | ||
"location": { | ||
"type": "method", | ||
"class": "SearchesController", | ||
"method": "query_params" | ||
}, | ||
"user_input": null, | ||
"confidence": "Medium", | ||
"cwe_id": [ | ||
915 | ||
], | ||
"note": "Mass assignment not a risk as not using Active Record and parsing these parameters elsewhere" | ||
} | ||
], | ||
"updated": "2023-12-06 16:07:36 +0000", | ||
"brakeman_version": "6.1.0" | ||
} |
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