Skip to content

Commit 2c463c0

Browse files
run brakeman
1 parent 02ed939 commit 2c463c0

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

Gemfile.lock

+3
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ GEM
9494
ast (2.4.2)
9595
base64 (0.2.0)
9696
bigdecimal (3.1.5)
97+
brakeman (6.1.2)
98+
racc
9799
builder (3.2.4)
98100
concurrent-ruby (1.2.2)
99101
connection_pool (2.4.1)
@@ -273,6 +275,7 @@ PLATFORMS
273275
x86_64-darwin-21
274276

275277
DEPENDENCIES
278+
brakeman
276279
plutonium!
277280
rake (~> 13.0)
278281
rspec (~> 3.0)

brakeman.ignore

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"ignored_warnings": [
3+
{
4+
"warning_type": "Cross-Site Request Forgery",
5+
"warning_code": 7,
6+
"fingerprint": "1cb8570b8c91f38317cdf909e01e7016359846174f427e86011633c344d30fc3",
7+
"check_name": "ForgerySetting",
8+
"message": "`protect_from_forgery` should be called in `Plutonium::Reactor::ResourceController`",
9+
"file": "lib/plutonium/reactor/resource_controller.rb",
10+
"line": 10,
11+
"link": "https://brakemanscanner.org/docs/warning_types/cross-site_request_forgery/",
12+
"code": null,
13+
"render_path": null,
14+
"location": {
15+
"type": "controller",
16+
"controller": "Plutonium::Reactor::ResourceController"
17+
},
18+
"user_input": null,
19+
"confidence": "High",
20+
"cwe_id": [
21+
352
22+
],
23+
"note": "this is tested and confirmed to be a false flag"
24+
},
25+
{
26+
"warning_type": "Mass Assignment",
27+
"warning_code": 70,
28+
"fingerprint": "873ee0d868e06a32e8ff387a38ddb8c6183a419813d5c20122fa9c3a887f4e54",
29+
"check_name": "MassAssignment",
30+
"message": "Specify exact keys allowed for mass assignment instead of using `permit!` which allows any keys",
31+
"file": "lib/plutonium/reactor/resource_controller.rb",
32+
"line": 58,
33+
"link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
34+
"code": "params.require(resource_param_key).permit!",
35+
"render_path": null,
36+
"location": {
37+
"type": "method",
38+
"class": "Plutonium::Reactor::ResourceController",
39+
"method": "resource_params"
40+
},
41+
"user_input": null,
42+
"confidence": "Medium",
43+
"cwe_id": [
44+
915
45+
],
46+
"note": "we manually filter params"
47+
}
48+
],
49+
"updated": "2024-02-18 00:37:39 +0000",
50+
"brakeman_version": "6.1.2"
51+
}

lib/plutonium/reactor/resource_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def resource_record
5353
helper_method :resource_record
5454

5555
def resource_params
56+
# Example of documenting an ignore in the source code
57+
# NOTE: Brakeman warning ignored for MassAssignment because inputs are filtered manually
5658
input_params = params.require(resource_param_key).permit!.nilify.to_h
5759

5860
# Override any entity scoping params

plutonium.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Gem::Specification.new do |spec|
3939
spec.add_dependency "simple_form", "~> 5.3"
4040
spec.add_dependency "rabl", "~> 0.16.1"
4141

42+
spec.add_development_dependency "brakeman"
43+
4244
# For more information and examples about making a new gem, check out our
4345
# guide at: https://bundler.io/guides/creating_gem.html
4446
end

0 commit comments

Comments
 (0)