rack-simple_csrf 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bd1ac436f818ec61c32035bda83691a1e3c1be6
4
- data.tar.gz: 590eb39f69fba11d6e669dc0855aab8254f70924
3
+ metadata.gz: 5a3f71eb69ee873e167211e2d6b3514786b67c52
4
+ data.tar.gz: c3cf020c8483182ef16994f043a35b6db486a648
5
5
  SHA512:
6
- metadata.gz: 5ef169dc22529a218fd7da48788db481a4d62c62e27fad34862cb6bfe7476e07e4ff97d5f5b8d18879174ec88b013a1a049c8d0eba55c99eae1223af20f30a38
7
- data.tar.gz: d12cd87a46cfa4c9cbc547af1d472d53af636b968a70acbdbbcd3bbeb904b5b0a11fd601ba098d14c8de3b4b7ebbb39ce914c919a24c7174574c61092894175b
6
+ metadata.gz: 6d60eeeba64c0cbd6107e304885819c883d5c514707e432d9a704aad6ae62af03e59f02d6a765f172b10f8b4d05218d1f77722b76623dfbb5689f9200ea28795
7
+ data.tar.gz: 4dd17845710a18f567a32fe3b3896de3bde205497c1e529e98523229bb3afc5284f20265d2db9aced75239e88eb4855f0d6840bbcc48da1c983fd067db1b3fc8
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Jordon Bedwell
1
+ Copyright (c) 2013-2015 Jordon Bedwell
2
2
 
3
3
  MIT License
4
4
 
@@ -1,6 +1,6 @@
1
1
  # Rack::Csrf
2
2
 
3
- [![Build Status](https://travis-ci.org/envygeeks/rack-simple_csrf.png?branch=master)](https://travis-ci.org/envygeeks/rack-simple_csrf) [![Coverage Status](https://coveralls.io/repos/envygeeks/rack-simple_csrf/badge.png?branch=master)](https://coveralls.io/r/envygeeks/rack-simple_csrf) [![Code Climate](https://codeclimate.com/github/envygeeks/rack-simple_csrf.png)](https://codeclimate.com/github/envygeeks/rack-simple_csrf) [![Dependency Status](https://gemnasium.com/envygeeks/rack-simple_csrf.png)](https://gemnasium.com/envygeeks/rack-simple_csrf)
3
+ [![Build Status](https://travis-ci.org/envygeeks/ruby-rack-simple_csrf.png?branch=master)](https://travis-ci.org/envygeeks/ruby-rack-simple_csrf) [![Coverage Status](https://coveralls.io/repos/envygeeks/ruby-rack-simple_csrf/badge.png?branch=master)](https://coveralls.io/r/envygeeks/ruby-rack-simple_csrf) [![Code Climate](https://codeclimate.com/github/envygeeks/ruby-rack-simple_csrf.png)](https://codeclimate.com/github/envygeeks/ruby-rack-simple_csrf) [![Dependency Status](https://gemnasium.com/envygeeks/ruby-rack-simple_csrf.png)](https://gemnasium.com/envygeeks/ruby-rack-simple_csrf)
4
4
 
5
5
  Rack::SimpleCsrf is my personal version of CSRF for Rack. It implements only a skip list where everything else must be run through the validator. It does not allow you to be explicit in what you validate, only explicit in what you do not validate. The goal is to increase security and make you think about what you are doing before you decide to do it.
6
6
 
@@ -56,22 +56,22 @@ module Rack
56
56
  return false if ! @skip.is_a?(Array) || @skip.empty?
57
57
  method = Regexp.escape(req.request_method)
58
58
  path = Regexp.escape(req.path)
59
- matched = @skip.select do |p|
59
+ @skip.select do |p|
60
60
  p = p.split ":"
61
61
  if p.size > 1
62
62
  if method !~ /\A#{p[0]}\Z/
63
- return false
63
+ next
64
64
  end
65
65
 
66
- p = p[1..-1].join ":"
66
+ p.shift
67
67
  end
68
68
 
69
- if path =~ /\A#{p}\Z/
69
+ if path =~ /\A#{p.join(":")}\Z/
70
70
  return true
71
71
  end
72
72
  end
73
73
 
74
- matched.size > 0
74
+ false
75
75
  end
76
76
 
77
77
  private
@@ -95,12 +95,12 @@ module Rack
95
95
  module Helpers
96
96
  extend self
97
97
 
98
- def csrf_meta_tag(opts = {}, session = session)
98
+ def csrf_meta_tag(opts = {}, session = self.session)
99
99
  %Q{<meta name="#{opts[:field] || "auth"}" content="#{ \
100
100
  session[opts[:key] || "csrf"]}">}
101
101
  end
102
102
 
103
- def csrf_form_tag(opts = {}, session = session)
103
+ def csrf_form_tag(opts = {}, session = self.session)
104
104
  session_key = session[opts[:key] || "csrf"]
105
105
  tag = opts[:tag] || "div"
106
106
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class SimpleCsrf
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,106 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-simple_csrf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.5'
20
15
  requirement: !ruby/object:Gem::Requirement
21
16
  requirements:
22
- - - ~>
17
+ - - "~>"
23
18
  - !ruby/object:Gem::Version
24
19
  version: '1.5'
25
- prerelease: false
26
20
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: envygeeks-coveralls
21
+ prerelease: false
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - ~>
24
+ - - "~>"
32
25
  - !ruby/object:Gem::Version
33
- version: '0.2'
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: envygeeks-coveralls
34
29
  requirement: !ruby/object:Gem::Requirement
35
30
  requirements:
36
- - - ~>
31
+ - - "~>"
37
32
  - !ruby/object:Gem::Version
38
- version: '0.2'
39
- prerelease: false
33
+ version: '1.0'
40
34
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: luna-rspec-formatters
35
+ prerelease: false
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
- - - ~>
38
+ - - "~>"
46
39
  - !ruby/object:Gem::Version
47
- version: '1.2'
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: luna-rspec-formatters
48
43
  requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
- - - ~>
45
+ - - "~>"
51
46
  - !ruby/object:Gem::Version
52
- version: '1.2'
53
- prerelease: false
47
+ version: '3.3'
54
48
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
49
+ prerelease: false
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '3.0'
54
+ version: '3.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
62
57
  requirement: !ruby/object:Gem::Requirement
63
58
  requirements:
64
- - - ~>
59
+ - - "~>"
65
60
  - !ruby/object:Gem::Version
66
- version: '3.0'
67
- prerelease: false
61
+ version: '3.3'
68
62
  type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
69
  description: A simpler CSRF middleware for Rack.
70
70
  email:
71
- - envygeeks@gmail.com
71
+ - jordon@envygeeks.io
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - Readme.md
77
- - Rakefile
78
- - License
79
76
  - Gemfile
77
+ - LICENSE
78
+ - README.md
79
+ - Rakefile
80
80
  - lib/rack/csrf.rb
81
81
  - lib/rack/simple_csrf.rb
82
82
  - lib/rack/simple_csrf/version.rb
83
83
  homepage: https://envygeeks.com/projects/rack-csrf
84
84
  licenses: []
85
85
  metadata: {}
86
- post_install_message:
86
+ post_install_message:
87
87
  rdoc_options: []
88
88
  require_paths:
89
89
  - lib
90
90
  required_ruby_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.1.9
103
- signing_key:
101
+ rubyforge_project:
102
+ rubygems_version: 2.4.8
103
+ signing_key:
104
104
  specification_version: 4
105
105
  summary: A simpler CSRF middleware for Rack.
106
106
  test_files: []