angular_csrf 0.1.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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +54 -0
  3. data/Rakefile +6 -0
  4. data/lib/angular_csrf.rb +21 -0
  5. data/lib/generators/angular_csrf/USAGE +9 -0
  6. data/lib/generators/angular_csrf/angular_csrf_generator.rb +7 -0
  7. data/lib/generators/angular_csrf/templates/angular_csrf.rb +1 -0
  8. data/lib/version.rb +3 -0
  9. data/spec/angular_csrf_spec.rb +33 -0
  10. data/spec/rails_app/Gemfile +4 -0
  11. data/spec/rails_app/Gemfile.lock +86 -0
  12. data/spec/rails_app/Rakefile +6 -0
  13. data/spec/rails_app/app/assets/javascripts/application.js +13 -0
  14. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  15. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  16. data/spec/rails_app/app/controllers/guinea_pig_controller.rb +14 -0
  17. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  18. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  19. data/spec/rails_app/bin/bundle +3 -0
  20. data/spec/rails_app/bin/rails +4 -0
  21. data/spec/rails_app/bin/rake +4 -0
  22. data/spec/rails_app/config/application.rb +31 -0
  23. data/spec/rails_app/config/boot.rb +4 -0
  24. data/spec/rails_app/config/environment.rb +5 -0
  25. data/spec/rails_app/config/environments/development.rb +25 -0
  26. data/spec/rails_app/config/environments/production.rb +64 -0
  27. data/spec/rails_app/config/environments/test.rb +39 -0
  28. data/spec/rails_app/config/initializers/angular_csrf.rb +1 -0
  29. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  30. data/spec/rails_app/config/initializers/cookies_serializer.rb +3 -0
  31. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  32. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  33. data/spec/rails_app/config/initializers/mime_types.rb +4 -0
  34. data/spec/rails_app/config/initializers/session_store.rb +3 -0
  35. data/spec/rails_app/config/initializers/wrap_parameters.rb +9 -0
  36. data/spec/rails_app/config/locales/en.yml +23 -0
  37. data/spec/rails_app/config/routes.rb +5 -0
  38. data/spec/rails_app/config/secrets.yml +22 -0
  39. data/spec/rails_app/config.ru +4 -0
  40. data/spec/rails_app/db/seeds.rb +7 -0
  41. data/spec/rails_app/log/development.log +20 -0
  42. data/spec/rails_app/log/test.log +1663 -0
  43. data/spec/rails_app/public/404.html +67 -0
  44. data/spec/rails_app/public/422.html +67 -0
  45. data/spec/rails_app/public/500.html +66 -0
  46. data/spec/rails_app/public/favicon.ico +0 -0
  47. data/spec/rails_app/public/robots.txt +5 -0
  48. data/spec/rails_helper.rb +5 -0
  49. data/spec/spec_helper.rb +88 -0
  50. metadata +177 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -0,0 +1,5 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require 'spec_helper'
4
+ require 'rails_app/config/environment'
5
+ require 'rspec/rails'
@@ -0,0 +1,88 @@
1
+ require 'rspec'
2
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
3
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
4
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
5
+ # file to always be loaded, without a need to explicitly require it in any files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need it.
13
+ #
14
+ # The `.rspec` file also contains a few flags that are not defaults but that
15
+ # users commonly want.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # The settings below are suggested to provide a good initial experience
43
+ # with RSpec, but feel free to customize to your heart's content.
44
+
45
+ # These two settings work together to allow you to limit a spec run
46
+ # to individual examples or groups you care about by tagging them with
47
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48
+ # get run.
49
+ config.filter_run :focus
50
+ config.run_all_when_everything_filtered = true
51
+
52
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
53
+ # For more details, see:
54
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
55
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
56
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
57
+ config.disable_monkey_patching!
58
+
59
+ # disable monkey patching (see disable_monkey_patching! above) except for exposing the Rspec DSL
60
+ config.expose_dsl_globally = true
61
+
62
+ # Many RSpec users commonly either run the entire suite or an individual
63
+ # file, and it's useful to allow more verbose output when running an
64
+ # individual spec file.
65
+ if config.files_to_run.one?
66
+ # Use the documentation formatter for detailed output,
67
+ # unless a formatter has already been configured
68
+ # (e.g. via a command-line flag).
69
+ config.default_formatter = 'doc'
70
+ end
71
+
72
+ # Print the 10 slowest examples and example groups at the
73
+ # end of the spec run, to help surface which specs are running
74
+ # particularly slow.
75
+ config.profile_examples = 10
76
+
77
+ # Run specs in random order to surface order dependencies. If you find an
78
+ # order dependency and want to debug it, you can fix the order by providing
79
+ # the seed, which is printed after each run.
80
+ # --seed 1234
81
+ config.order = :random
82
+
83
+ # Seed global randomization in this process using the `--seed` CLI option.
84
+ # Setting this allows you to use `--seed` to deterministically reproduce
85
+ # test failures related to randomization by passing the same `--seed` value
86
+ # as the one that triggered the failure.
87
+ Kernel.srand config.seed
88
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: angular_csrf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chaker Nakhli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: Adapt CSRF protection in Rails applications and webservices to handle
56
+ AngularJS clients.
57
+ email:
58
+ - chaker.nakhli@sinbadsoft.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - README.md
64
+ - Rakefile
65
+ - lib/angular_csrf.rb
66
+ - lib/generators/angular_csrf/USAGE
67
+ - lib/generators/angular_csrf/angular_csrf_generator.rb
68
+ - lib/generators/angular_csrf/templates/angular_csrf.rb
69
+ - lib/version.rb
70
+ - spec/angular_csrf_spec.rb
71
+ - spec/rails_app/Gemfile
72
+ - spec/rails_app/Gemfile.lock
73
+ - spec/rails_app/Rakefile
74
+ - spec/rails_app/app/assets/javascripts/application.js
75
+ - spec/rails_app/app/assets/stylesheets/application.css
76
+ - spec/rails_app/app/controllers/application_controller.rb
77
+ - spec/rails_app/app/controllers/guinea_pig_controller.rb
78
+ - spec/rails_app/app/helpers/application_helper.rb
79
+ - spec/rails_app/app/views/layouts/application.html.erb
80
+ - spec/rails_app/bin/bundle
81
+ - spec/rails_app/bin/rails
82
+ - spec/rails_app/bin/rake
83
+ - spec/rails_app/config.ru
84
+ - spec/rails_app/config/application.rb
85
+ - spec/rails_app/config/boot.rb
86
+ - spec/rails_app/config/environment.rb
87
+ - spec/rails_app/config/environments/development.rb
88
+ - spec/rails_app/config/environments/production.rb
89
+ - spec/rails_app/config/environments/test.rb
90
+ - spec/rails_app/config/initializers/angular_csrf.rb
91
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
92
+ - spec/rails_app/config/initializers/cookies_serializer.rb
93
+ - spec/rails_app/config/initializers/filter_parameter_logging.rb
94
+ - spec/rails_app/config/initializers/inflections.rb
95
+ - spec/rails_app/config/initializers/mime_types.rb
96
+ - spec/rails_app/config/initializers/session_store.rb
97
+ - spec/rails_app/config/initializers/wrap_parameters.rb
98
+ - spec/rails_app/config/locales/en.yml
99
+ - spec/rails_app/config/routes.rb
100
+ - spec/rails_app/config/secrets.yml
101
+ - spec/rails_app/db/seeds.rb
102
+ - spec/rails_app/log/development.log
103
+ - spec/rails_app/log/test.log
104
+ - spec/rails_app/public/404.html
105
+ - spec/rails_app/public/422.html
106
+ - spec/rails_app/public/500.html
107
+ - spec/rails_app/public/favicon.ico
108
+ - spec/rails_app/public/robots.txt
109
+ - spec/rails_helper.rb
110
+ - spec/spec_helper.rb
111
+ homepage: http://github.com/sinbadsoft/angular_csrf
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options:
117
+ - "--charset=UTF-8"
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 1.9.2
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 2.2.2
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: Add support for AngularJS clients to Rails CSRF protection
136
+ test_files:
137
+ - spec/angular_csrf_spec.rb
138
+ - spec/rails_app/app/assets/javascripts/application.js
139
+ - spec/rails_app/app/assets/stylesheets/application.css
140
+ - spec/rails_app/app/controllers/application_controller.rb
141
+ - spec/rails_app/app/controllers/guinea_pig_controller.rb
142
+ - spec/rails_app/app/helpers/application_helper.rb
143
+ - spec/rails_app/app/views/layouts/application.html.erb
144
+ - spec/rails_app/bin/bundle
145
+ - spec/rails_app/bin/rails
146
+ - spec/rails_app/bin/rake
147
+ - spec/rails_app/config/application.rb
148
+ - spec/rails_app/config/boot.rb
149
+ - spec/rails_app/config/environment.rb
150
+ - spec/rails_app/config/environments/development.rb
151
+ - spec/rails_app/config/environments/production.rb
152
+ - spec/rails_app/config/environments/test.rb
153
+ - spec/rails_app/config/initializers/angular_csrf.rb
154
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
155
+ - spec/rails_app/config/initializers/cookies_serializer.rb
156
+ - spec/rails_app/config/initializers/filter_parameter_logging.rb
157
+ - spec/rails_app/config/initializers/inflections.rb
158
+ - spec/rails_app/config/initializers/mime_types.rb
159
+ - spec/rails_app/config/initializers/session_store.rb
160
+ - spec/rails_app/config/initializers/wrap_parameters.rb
161
+ - spec/rails_app/config/locales/en.yml
162
+ - spec/rails_app/config/routes.rb
163
+ - spec/rails_app/config/secrets.yml
164
+ - spec/rails_app/config.ru
165
+ - spec/rails_app/db/seeds.rb
166
+ - spec/rails_app/Gemfile
167
+ - spec/rails_app/Gemfile.lock
168
+ - spec/rails_app/log/development.log
169
+ - spec/rails_app/log/test.log
170
+ - spec/rails_app/public/404.html
171
+ - spec/rails_app/public/422.html
172
+ - spec/rails_app/public/500.html
173
+ - spec/rails_app/public/favicon.ico
174
+ - spec/rails_app/public/robots.txt
175
+ - spec/rails_app/Rakefile
176
+ - spec/rails_helper.rb
177
+ - spec/spec_helper.rb