rack-delete_cookies_from_public_requests 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d053d3582f7dedca3368dd2f2d8ae5ca5004a60a
4
+ data.tar.gz: e9ebedd3845b1f6a2bbf354faad8e01376522289
5
+ SHA512:
6
+ metadata.gz: 49ee5c478b70f4de5b51cb2da70abf2a0efee191cbc770735279134d87e0063dffd9842aa76a51f0a5196b1b2e6d5a9ea972e2665a3239d57882e31a2b70ddfc
7
+ data.tar.gz: 5af845281f5d8a0f7772d725c8cfdee0a6ad8094fa428e04631d47f312b3a3e2fe5a76773949b720306d7a9b49f3fda134ad30101a75f4fcf94e289b6aa29380
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rack-delete_cookies_from_public_requests.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Rack::DeleteCookiesFromPublicRequests
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rack/delete_cookies_from_public_requests`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rack-delete_cookies_from_public_requests'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rack-delete_cookies_from_public_requests
22
+
23
+ ## Concept
24
+
25
+ The goal of this gem is to strip cookies from responses that are going to be cached publicly. This makes it possible to cache these pages on CDNs, and reverse proxies like varnish.
26
+
27
+ ## Usage
28
+
29
+ To make the middleware available in all environments, open `config/application.rb` and add in `class Application < Rails::Application`:
30
+
31
+ ```ruby
32
+ config.middleware.insert_before(ActionDispatch::Cookies, Rack::DeleteCookiesFromPublicRequests)
33
+ ```
34
+
35
+ If you want to customize the environment in which the middleware is enabled edit the respective environment files instead.
36
+
37
+ You can verify the middleware positioning by typing `rake middleware` in the root of your application.
38
+
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gja/rack-delete_cookies_from_public_requests.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rack/delete_cookies_from_public_requests"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ require "rack/delete_cookies_from_public_requests/version"
2
+
3
+ module Rack
4
+ class DeleteCookiesFromPublicRequests
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ status, headers, body = @app.call(env)
11
+ if headers && /public/.match(headers["Cache-Control"])
12
+ headers.delete("Set-Cookie")
13
+ end
14
+ [status, headers, body]
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ class DeleteCookiesFromPublicRequests
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rack/delete_cookies_from_public_requests/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rack-delete_cookies_from_public_requests"
8
+ spec.version = Rack::DeleteCookiesFromPublicRequests::VERSION
9
+ spec.authors = ["Tejas Dinkar"]
10
+ spec.email = ["tejas@gja.in"]
11
+
12
+ spec.summary = %q{Delete Set-Cookie header in case Cache-Control contain public}
13
+ spec.description = %q{This is particularly useful in case of varnish caches, preventing them from logging you in as a random person.}
14
+ spec.homepage = "https://github.com/gja/rack-delete_cookies_from_public_requests"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.11"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-delete_cookies_from_public_requests
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tejas Dinkar
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: This is particularly useful in case of varnish caches, preventing them
56
+ from logging you in as a random person.
57
+ email:
58
+ - tejas@gja.in
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - lib/rack/delete_cookies_from_public_requests.rb
72
+ - lib/rack/delete_cookies_from_public_requests/version.rb
73
+ - rack-delete_cookies_from_public_requests.gemspec
74
+ homepage: https://github.com/gja/rack-delete_cookies_from_public_requests
75
+ licenses: []
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.5.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Delete Set-Cookie header in case Cache-Control contain public
97
+ test_files: []