validation_auditor 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/validation_auditor.rb +1 -1
- data/lib/validation_auditor/version.rb +1 -1
- data/test/controller_test.rb +15 -0
- data/validation_auditor.gemspec +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8664c5178740a633a0bb4aaa9a45759f42d89172
|
4
|
+
data.tar.gz: 30bfae7d982876df10bed64f044e6b23f7c8fb97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 230cc22ca8f65f389fd187f78f41a126e0dae8270a2f9d019b2ca9d8f52792c705c8e0a9e7041f0aaccbd703dcdc401b91f765366e3a58e65ee677d4e9130583
|
7
|
+
data.tar.gz: 94dbfbff65772ff7a50b9d275db2365f07bfc4caf3122808ebcc9127bf024bb6ebc2f8db29bbe4d928e6923056ebe3fda055c4bc85534b8f0cc00d9cf08edf2f
|
data/CHANGELOG.md
CHANGED
data/lib/validation_auditor.rb
CHANGED
@@ -78,7 +78,7 @@ module ValidationAuditor
|
|
78
78
|
end
|
79
79
|
if ValidationAuditor::Controller.request.present?
|
80
80
|
request = ValidationAuditor::Controller.request
|
81
|
-
va.params = ValidationAuditor::Controller.clean_params(request.
|
81
|
+
va.params = ValidationAuditor::Controller.clean_params(request.filtered_parameters)
|
82
82
|
va.url = request.url
|
83
83
|
va.user_agent = request.env["HTTP_USER_AGENT"]
|
84
84
|
end
|
data/test/controller_test.rb
CHANGED
@@ -73,6 +73,21 @@ class ControllerTest < ActionController::TestCase
|
|
73
73
|
assert_equal audit.data["name"], "John Doe"
|
74
74
|
assert_nil audit.data["email"]
|
75
75
|
assert_equal ["can't be blank"], audit.failures[:email]
|
76
|
+
assert audit.params["deep"]["structure"]["with"]["file"].is_a? String
|
77
|
+
end
|
78
|
+
|
79
|
+
should "not include filtered params in validation audits" do
|
80
|
+
assert_difference "ValidationAuditor::ValidationAudit.count" => +1 do
|
81
|
+
@request.env["action_dispatch.parameter_filter"] = [:password]
|
82
|
+
post :create, audited_record: {name: "John Doe"}, password: "secret" # Missing email and a password that should be filtered.
|
83
|
+
end
|
84
|
+
audit = ValidationAuditor::ValidationAudit.order(:id).last
|
85
|
+
assert_nil audit.record # New records cannot be referenced because they don't exist...
|
86
|
+
assert_equal "AuditedRecord", audit.record_type # but we still record the name.
|
87
|
+
assert_equal audit.data["name"], "John Doe"
|
88
|
+
assert_nil audit.data["email"]
|
89
|
+
assert_equal ["can't be blank"], audit.failures[:email]
|
90
|
+
assert_not_equal "secret", audit.params["password"]
|
76
91
|
end
|
77
92
|
|
78
93
|
context "With a record" do
|
data/validation_auditor.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
+
spec.required_ruby_version = ">= 1.9.3"
|
23
24
|
spec.add_dependency "activerecord", "> 3.2.0"
|
24
25
|
spec.add_dependency "actionpack", "> 3.2.0"
|
25
26
|
spec.add_dependency "railties", "> 3.2.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validation_auditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J. Pablo Fernández
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements:
|
91
91
|
- - ">="
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
93
|
+
version: 1.9.3
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|