rack-protection 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack-protection might be problematic. Click here for more details.
- data/README.md +15 -1
- data/lib/rack/protection/json_csrf.rb +2 -2
- data/lib/rack/protection/version.rb +2 -2
- data/rack-protection.gemspec +7 -3
- data/spec/json_csrf_spec.rb +9 -0
- metadata +15 -11
data/README.md
CHANGED
@@ -43,6 +43,7 @@ Prevented by:
|
|
43
43
|
* `Rack::Protection::JsonCsrf`
|
44
44
|
* `Rack::Protection::RemoteReferrer` (not included by `use Rack::Protection`)
|
45
45
|
* `Rack::Protection::RemoteToken`
|
46
|
+
|
46
47
|
## Cross Site Scripting
|
47
48
|
|
48
49
|
Prevented by:
|
@@ -70,7 +71,6 @@ Prevented by:
|
|
70
71
|
|
71
72
|
## IP Spoofing
|
72
73
|
|
73
|
-
|
74
74
|
Prevented by:
|
75
75
|
|
76
76
|
* `Rack::Protection::IPSpoofing`
|
@@ -78,3 +78,17 @@ Prevented by:
|
|
78
78
|
# Installation
|
79
79
|
|
80
80
|
gem install rack-protection
|
81
|
+
|
82
|
+
# History
|
83
|
+
|
84
|
+
## v0.1.0 (2011/06/20)
|
85
|
+
|
86
|
+
First public release.
|
87
|
+
|
88
|
+
## v1.0.0 (2011/09/02)
|
89
|
+
|
90
|
+
First stable release.
|
91
|
+
|
92
|
+
Changes:
|
93
|
+
|
94
|
+
* Fix bug in JsonCsrf
|
@@ -7,7 +7,7 @@ module Rack
|
|
7
7
|
# Supported browsers:: all
|
8
8
|
# More infos:: http://flask.pocoo.org/docs/security/#json-security
|
9
9
|
#
|
10
|
-
# JSON GET APIs are
|
10
|
+
# JSON GET APIs are vulnerable to being embedded as JavaScript while the
|
11
11
|
# Array prototype has been patched to track data. Checks the referrer
|
12
12
|
# even on GET requests if the content type is JSON.
|
13
13
|
class JsonCsrf < Base
|
@@ -15,7 +15,7 @@ module Rack
|
|
15
15
|
|
16
16
|
def call(env)
|
17
17
|
status, headers, body = app.call(env)
|
18
|
-
if headers['Content-Type'].to_s.split(';', 2).first
|
18
|
+
if headers['Content-Type'].to_s.split(';', 2).first =~ /^\s*application\/json\s*$/
|
19
19
|
result = react(env) if referrer(env) != Request.new(env).host
|
20
20
|
end
|
21
21
|
result or [status, headers, body]
|
data/rack-protection.gemspec
CHANGED
@@ -2,19 +2,23 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
# general infos
|
4
4
|
s.name = "rack-protection"
|
5
|
-
s.version = "
|
5
|
+
s.version = "1.0.0"
|
6
6
|
s.description = "You should use protection!"
|
7
7
|
s.homepage = "http://github.com/rkh/rack-protection"
|
8
8
|
s.summary = s.description
|
9
9
|
|
10
10
|
# generated from git shortlog -sn
|
11
11
|
s.authors = [
|
12
|
-
"Konstantin Haase"
|
12
|
+
"Konstantin Haase",
|
13
|
+
"Corey Ward",
|
14
|
+
"Fojas"
|
13
15
|
]
|
14
16
|
|
15
17
|
# generated from git shortlog -sne
|
16
18
|
s.email = [
|
17
|
-
"konstantin.mailinglists@googlemail.com"
|
19
|
+
"konstantin.mailinglists@googlemail.com",
|
20
|
+
"coreyward@me.com",
|
21
|
+
"developer@fojasaur.us"
|
18
22
|
]
|
19
23
|
|
20
24
|
# generated from git ls-files
|
data/spec/json_csrf_spec.rb
CHANGED
@@ -20,4 +20,13 @@ describe Rack::Protection::JsonCsrf do
|
|
20
20
|
get('/', {}).should be_ok
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
describe 'not json response' do
|
25
|
+
|
26
|
+
it "accepts get requests with 304 headers" do
|
27
|
+
mock_app { |e| [304, {}, []]}
|
28
|
+
get('/', {}).status.should == 304
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
23
32
|
end
|
metadata
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-protection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Konstantin Haase
|
9
|
+
- Corey Ward
|
10
|
+
- Fojas
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date: 2011-
|
14
|
+
date: 2011-09-02 00:00:00.000000000Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: rack
|
16
|
-
requirement: &
|
18
|
+
requirement: &2151828860 !ruby/object:Gem::Requirement
|
17
19
|
none: false
|
18
20
|
requirements:
|
19
21
|
- - ! '>='
|
@@ -21,10 +23,10 @@ dependencies:
|
|
21
23
|
version: '0'
|
22
24
|
type: :runtime
|
23
25
|
prerelease: false
|
24
|
-
version_requirements: *
|
26
|
+
version_requirements: *2151828860
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: escape_utils
|
27
|
-
requirement: &
|
29
|
+
requirement: &2151828040 !ruby/object:Gem::Requirement
|
28
30
|
none: false
|
29
31
|
requirements:
|
30
32
|
- - ! '>='
|
@@ -32,10 +34,10 @@ dependencies:
|
|
32
34
|
version: '0'
|
33
35
|
type: :runtime
|
34
36
|
prerelease: false
|
35
|
-
version_requirements: *
|
37
|
+
version_requirements: *2151828040
|
36
38
|
- !ruby/object:Gem::Dependency
|
37
39
|
name: rack-test
|
38
|
-
requirement: &
|
40
|
+
requirement: &2151827300 !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
42
|
requirements:
|
41
43
|
- - ! '>='
|
@@ -43,10 +45,10 @@ dependencies:
|
|
43
45
|
version: '0'
|
44
46
|
type: :development
|
45
47
|
prerelease: false
|
46
|
-
version_requirements: *
|
48
|
+
version_requirements: *2151827300
|
47
49
|
- !ruby/object:Gem::Dependency
|
48
50
|
name: rspec
|
49
|
-
requirement: &
|
51
|
+
requirement: &2151826180 !ruby/object:Gem::Requirement
|
50
52
|
none: false
|
51
53
|
requirements:
|
52
54
|
- - ~>
|
@@ -54,10 +56,12 @@ dependencies:
|
|
54
56
|
version: '2.0'
|
55
57
|
type: :development
|
56
58
|
prerelease: false
|
57
|
-
version_requirements: *
|
59
|
+
version_requirements: *2151826180
|
58
60
|
description: You should use protection!
|
59
61
|
email:
|
60
62
|
- konstantin.mailinglists@googlemail.com
|
63
|
+
- coreyward@me.com
|
64
|
+
- developer@fojasaur.us
|
61
65
|
executables: []
|
62
66
|
extensions: []
|
63
67
|
extra_rdoc_files: []
|
@@ -114,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
118
|
version: '0'
|
115
119
|
requirements: []
|
116
120
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.6
|
118
122
|
signing_key:
|
119
123
|
specification_version: 3
|
120
124
|
summary: You should use protection!
|