active_interaction 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/README.md +1 -1
- data/lib/active_interaction.rb +1 -1
- data/lib/active_interaction/concerns/missable.rb +1 -1
- data/lib/active_interaction/filters/hash_filter.rb +8 -3
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/errors_spec.rb +15 -5
- data/spec/active_interaction/filter_spec.rb +3 -1
- data/spec/active_interaction/i18n_spec.rb +12 -8
- metadata +40 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9a8019b903bfbeba2211de79394b8b0dbfb4cb7
|
4
|
+
data.tar.gz: 296e024fabb906a8e7c384ce24a4cbfbee9399c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75830ad9762f759a717a663bfc3e2e1a0f55dcdfcc07499aef6ac3aca60678f309b05a46d69323c338dd4e3fd7f5f6f123bcc486a22c9373dcef2392638d540
|
7
|
+
data.tar.gz: 219168712b0e6eb4dcbe9d040b0fcc2efd29349265c0d5b6c243896eb9bd5d3e81df816884fbbe36efc9348e5a7bd1c00cc0031b1f029243225ce9366a6f677f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# [Master][]
|
2
2
|
|
3
|
+
# [1.1.3][] (2014-03-31)
|
4
|
+
|
5
|
+
- Fix Rubocop errors and pin the version to avoid future issues with new cops
|
6
|
+
breaking the build.
|
7
|
+
- Fix some denial of service attacks via hash symbolization. (See [#163][] for details)
|
8
|
+
|
3
9
|
# [1.1.2][] (2014-03-05)
|
4
10
|
|
5
11
|
- Don't constantize classes for model filters on initialization. This fixes a
|
@@ -164,7 +170,8 @@
|
|
164
170
|
|
165
171
|
- Initial release.
|
166
172
|
|
167
|
-
[
|
173
|
+
[Master]: https://github.com/orgsync/active_interaction/compare/v1.1.3...master
|
174
|
+
[1.1.3]: https://github.com/orgsync/active_interaction/compare/v1.1.2...v1.1.3
|
168
175
|
[1.1.2]: https://github.com/orgsync/active_interaction/compare/v1.1.1...v1.1.2
|
169
176
|
[1.1.1]: https://github.com/orgsync/active_interaction/compare/v1.1.0...v1.1.1
|
170
177
|
[1.1.0]: https://github.com/orgsync/active_interaction/compare/v1.0.5...v1.1.0
|
@@ -193,3 +200,5 @@
|
|
193
200
|
[0.1.2]: https://github.com/orgsync/active_interaction/compare/v0.1.1...v0.1.2
|
194
201
|
[0.1.1]: https://github.com/orgsync/active_interaction/compare/v0.1.0...v0.1.1
|
195
202
|
[0.1.0]: https://github.com/orgsync/active_interaction/compare/62f999b...v0.1.0
|
203
|
+
|
204
|
+
[#163]: https://github.com/orgsync/active_interaction/pull/163
|
data/README.md
CHANGED
data/lib/active_interaction.rb
CHANGED
@@ -8,7 +8,11 @@ module ActiveInteraction
|
|
8
8
|
#
|
9
9
|
# @!macro filter_method_params
|
10
10
|
# @param block [Proc] filter methods to apply for select keys
|
11
|
-
# @option options [Boolean] :strip (true) strip unknown keys
|
11
|
+
# @option options [Boolean] :strip (true) strip unknown keys (Note: All
|
12
|
+
# keys are symbolized. Ruby does not GC symbols so this can cause
|
13
|
+
# memory bloat. Setting this option to `false` and passing in non-safe
|
14
|
+
# input (e.g. Rails `params`) opens your software to a denial of
|
15
|
+
# service attack.)
|
12
16
|
#
|
13
17
|
# @example
|
14
18
|
# hash :order
|
@@ -26,10 +30,11 @@ module ActiveInteraction
|
|
26
30
|
def cast(value)
|
27
31
|
case value
|
28
32
|
when Hash
|
29
|
-
value = value.
|
33
|
+
value = value.stringify_keys
|
30
34
|
filters.each_with_object(strip? ? {} : value) do |(name, filter), h|
|
35
|
+
name = name.to_s
|
31
36
|
h[name] = filter.clean(value[name])
|
32
|
-
end
|
37
|
+
end.symbolize_keys
|
33
38
|
else
|
34
39
|
super
|
35
40
|
end
|
@@ -132,11 +132,21 @@ describe ActiveInteraction::Errors do
|
|
132
132
|
|
133
133
|
context 'with an interpolated symbolic error' do
|
134
134
|
before do
|
135
|
-
I18n.backend.store_translations('en',
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
I18n.backend.store_translations('en',
|
136
|
+
activemodel: {
|
137
|
+
errors: {
|
138
|
+
models: {
|
139
|
+
klass.name => {
|
140
|
+
attributes: {
|
141
|
+
attribute: {
|
142
|
+
invalid_type: 'is not a valid %{type}'
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
)
|
140
150
|
|
141
151
|
other.add_sym(:attribute, :invalid_type, type: nil)
|
142
152
|
end
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
5
|
+
module ActiveInteraction
|
6
|
+
class TestFilter < ActiveInteraction::Filter; end
|
7
|
+
end
|
6
8
|
class TestFilter < ActiveInteraction::Filter; end
|
7
9
|
|
8
10
|
describe ActiveInteraction::Filter, :filter do
|
@@ -72,14 +72,18 @@ describe I18nInteraction do
|
|
72
72
|
include_examples 'translation'
|
73
73
|
|
74
74
|
before do
|
75
|
-
I18n.backend.store_translations('hsilgne',
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
I18n.backend.store_translations('hsilgne',
|
76
|
+
active_interaction: {
|
77
|
+
errors: {
|
78
|
+
messages: {
|
79
|
+
invalid: 'is invalid'.reverse,
|
80
|
+
invalid_type: "%{type} #{'is not a valid'.reverse}",
|
81
|
+
missing: 'missing'.reverse
|
82
|
+
}
|
83
|
+
},
|
84
|
+
types: TYPES.each_with_object({}) { |e, a| a[e] = e.reverse }
|
85
|
+
}
|
86
|
+
)
|
83
87
|
|
84
88
|
I18n.locale = 'hsilgne'
|
85
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,124 +9,138 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3'
|
21
|
-
- -
|
21
|
+
- - <
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '5'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '3'
|
31
|
-
- -
|
31
|
+
- - <
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '5'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.5'
|
41
41
|
type: :development
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.5'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: coveralls
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.7'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.7'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: guard-rspec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.2'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '4.2'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: guard-rubocop
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: rake
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ~>
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '10.1'
|
83
97
|
type: :development
|
84
98
|
prerelease: false
|
85
99
|
version_requirements: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ~>
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '10.1'
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
105
|
name: rdoc
|
92
106
|
requirement: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ~>
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '4.1'
|
97
111
|
type: :development
|
98
112
|
prerelease: false
|
99
113
|
version_requirements: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ~>
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '4.1'
|
104
118
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
119
|
+
name: rubocop
|
106
120
|
requirement: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 0.19.1
|
111
125
|
type: :development
|
112
126
|
prerelease: false
|
113
127
|
version_requirements: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - '='
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 0.19.1
|
118
132
|
- !ruby/object:Gem::Dependency
|
119
133
|
name: yard
|
120
134
|
requirement: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - ~>
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0.8'
|
125
139
|
type: :development
|
126
140
|
prerelease: false
|
127
141
|
version_requirements: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - ~>
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '0.8'
|
132
146
|
description: Manage application specific business logic.
|
@@ -216,17 +230,17 @@ require_paths:
|
|
216
230
|
- lib
|
217
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
218
232
|
requirements:
|
219
|
-
- -
|
233
|
+
- - '>='
|
220
234
|
- !ruby/object:Gem::Version
|
221
235
|
version: 1.9.3
|
222
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
237
|
requirements:
|
224
|
-
- -
|
238
|
+
- - '>='
|
225
239
|
- !ruby/object:Gem::Version
|
226
240
|
version: '0'
|
227
241
|
requirements: []
|
228
242
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.2.
|
243
|
+
rubygems_version: 2.2.0
|
230
244
|
signing_key:
|
231
245
|
specification_version: 4
|
232
246
|
summary: Manage application specific business logic.
|