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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 411fc2578c6e75c4dd673dcaf450b9d983afee48
4
- data.tar.gz: d43b3a6365daf49c9ab70203ea90e5dc4fcaa9b8
3
+ metadata.gz: 8664c5178740a633a0bb4aaa9a45759f42d89172
4
+ data.tar.gz: 30bfae7d982876df10bed64f044e6b23f7c8fb97
5
5
  SHA512:
6
- metadata.gz: ed77c23dc4170250a96ab8affc6d9893dc7283418d494a21600d567cd9c1fb941364bf5746e9fe57a214c170f9295c95eda7abf269cd524b8451559e95ff519c
7
- data.tar.gz: 8e0ccfef2d9faf289a1a896574ae9bf5eb50686f39938478ce1bb55e70e30a14ea2f98d46bfc03e94a50e829f07941e004129abba548b657cb70ae4d5026f747
6
+ metadata.gz: 230cc22ca8f65f389fd187f78f41a126e0dae8270a2f9d019b2ca9d8f52792c705c8e0a9e7041f0aaccbd703dcdc401b91f765366e3a58e65ee677d4e9130583
7
+ data.tar.gz: 94dbfbff65772ff7a50b9d275db2365f07bfc4caf3122808ebcc9127bf024bb6ebc2f8db29bbe4d928e6923056ebe3fda055c4bc85534b8f0cc00d9cf08edf2f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## validation_auditor 0.2.0 (Jul 23, 2014) ##
2
+
3
+ * Respect the filter_parameters configuration from Rails.
4
+
1
5
  ## validation_auditor 0.1.1 (Jul 23, 2014) ##
2
6
 
3
7
  * Don't crash in the presence of file uploads when reporting validation errors.
@@ -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.params)
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
@@ -2,5 +2,5 @@
2
2
  # Copyright © 2014, Watu
3
3
 
4
4
  module ValidationAuditor
5
- VERSION = "0.1.1"
5
+ VERSION = "0.2.0"
6
6
  end
@@ -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
@@ -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.1.1
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: '0'
93
+ version: 1.9.3
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="