rack-utf8_sanitizer 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/rack/utf8_sanitizer.rb +1 -1
- data/rack-utf8_sanitizer.gemspec +1 -1
- data/test/test_utf8_sanitizer.rb +16 -0
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MGZjMzRmYTVhZmYwNWMzNGM3YzcyOGMyMzRlMjcyODgyMTE3MmM2Ng==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4d42f2e6a2f764e461788128386175081b503edd
|
4
|
+
data.tar.gz: c1cc7e23205a585cae528dab7fe2c72a34bc8e45
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Mjk1YzlhZjI5NTUwZjhjYWQ3OTNjNGY1YjA2OTc5NTYwODY5MDk0MjMwM2Yy
|
11
|
-
NDIyZGUwYTYzNTdhMDBjZmEyMjQxNTYzMzQwYzBmMTI2NzIxZTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NmNlYjBkODg3NzMyZmViYzkwZDg5OWFhNWY0M2UxZmY2YjJiYWY2ZjdiNWE2
|
14
|
-
OTkxMDNlMDg0OTQxMzZhNTg0NWM0YmMwYzUwN2Q4MmI1YzVjNzNiNzI5YmI0
|
15
|
-
NWYyY2M0MTQxZmRjYjAzNjY3ZmQ5ZjI3N2QxZTZkMjRlNWE5NzY=
|
6
|
+
metadata.gz: 798f321eaf7edd7e9af4f7992341b8395ad9d5a3a30f99b200ae1c501feb862d376282b6e0aaab28ddf9cd8c0d3e7cb986a509e7bdcd1042b5f0dbac0780ba5f
|
7
|
+
data.tar.gz: fd636a91993fbbedc933d0e8c1e6f5377fc03f136c7c4ac2d9b26308c1a36f4eda4f87aaf189531748d62e96541a0fac9d393bcfd41e77dd91029dde829cf959
|
data/lib/rack/utf8_sanitizer.rb
CHANGED
@@ -36,7 +36,7 @@ module Rack
|
|
36
36
|
if URI_FIELDS.include?(key)
|
37
37
|
env[key] = transfer_frozen(value,
|
38
38
|
sanitize_uri_encoded_string(value))
|
39
|
-
elsif key.start_with?("HTTP_")
|
39
|
+
elsif key.to_s.start_with?("HTTP_")
|
40
40
|
# Just sanitize the headers and leave them in UTF-8. There is
|
41
41
|
# no reason to have UTF-8 in headers, but if it's valid, let it be.
|
42
42
|
env[key] = transfer_frozen(value,
|
data/rack-utf8_sanitizer.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "rack-utf8_sanitizer"
|
5
|
-
gem.version = '1.2.
|
5
|
+
gem.version = '1.2.3'
|
6
6
|
gem.authors = ["Peter Zotov"]
|
7
7
|
gem.email = ["whitequark@whitequark.org"]
|
8
8
|
gem.description = %{Rack::UTF8Sanitizer is a Rack middleware which cleans up } <<
|
data/test/test_utf8_sanitizer.rb
CHANGED
@@ -152,6 +152,22 @@ describe Rack::UTF8Sanitizer do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
describe "with symbols in the env" do
|
156
|
+
before do
|
157
|
+
@uri_input = "http://bar/foo%E0\xe0".force_encoding('UTF-8')
|
158
|
+
end
|
159
|
+
|
160
|
+
it "sanitizes REQUEST_PATH with invalid UTF-8 URI input" do
|
161
|
+
env = @app.({ :requested_at => "2014-07-22",
|
162
|
+
"REQUEST_PATH" => @uri_input })
|
163
|
+
|
164
|
+
result = env["REQUEST_PATH"]
|
165
|
+
|
166
|
+
result.encoding.should == Encoding::US_ASCII
|
167
|
+
result.should.be.valid_encoding
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
155
171
|
describe "with form data" do
|
156
172
|
def request_env
|
157
173
|
@plain_input = "foo bar лол".force_encoding('UTF-8')
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-utf8_sanitizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bacon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bacon-colored_output
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Rack::UTF8Sanitizer is a Rack middleware which cleans up invalid UTF8
|
@@ -74,8 +74,8 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .gitignore
|
78
|
-
- .travis.yml
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
79
79
|
- CHANGELOG.md
|
80
80
|
- Gemfile
|
81
81
|
- LICENSE.txt
|
@@ -93,21 +93,20 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '1.9'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.4.1
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Rack::UTF8Sanitizer is a Rack middleware which cleans up invalid UTF8 characters
|
110
110
|
in request URI and headers.
|
111
111
|
test_files:
|
112
112
|
- test/test_utf8_sanitizer.rb
|
113
|
-
has_rdoc:
|