rack-cors 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack-cors might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d3e08e4dddeda03c7f6ae34307de611a84d848c
4
- data.tar.gz: a6353f11742d77141c3e0e62d2a48e7367275391
3
+ metadata.gz: 509192f6673d85eb0b23b4169f5d392d1e380fdc
4
+ data.tar.gz: 5b123af66d8580566d8012012f62f90e8f4043d8
5
5
  SHA512:
6
- metadata.gz: c613462413784ba147dc5efd45b355ae26c5c133637d428ddfe1aabd739c8c5d43a4b85827c7984448daf8baccf3ff1325a83cbb59a95145f0c5e25009fd700d
7
- data.tar.gz: 9d0887852ae6b1144cf15f34b630ed22ab5f05099b00fdad950c7df0f989424f343ecb471bf538f2f244eb037e7e1d1159565c8e770bd37bf983b6e770c14a0d
6
+ metadata.gz: 274193cd4cc2bca5187e0fd7aacb928558cc5a0bddcd236c56b7791ccc8e7ceaffd53f96bae15992960d614de3bfd1ed12c0fa459ad25b7c5313ec8d166bbe1b
7
+ data.tar.gz: ba69d913329a58954760c7acd2d0d574ca5620e90b98617c65cfc67136433b9b834c6364a018d01dd231632a44a2c5ee4a398bd5fe1d4c27af44ed50e8c0cfbd
data/CHANGELOG CHANGED
@@ -1,6 +1,10 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 1.0.1 - 2017-07-18
5
+ ### Fixed
6
+ - Allow lambda origin configuration
7
+
4
8
  ## 1.0.0 - 2017-07-15
5
9
  ### Security
6
10
  - Don't implicitly accept 'null' origins when 'file://' is specified
@@ -272,7 +272,8 @@ module Rack
272
272
  def origins(*args, &blk)
273
273
  @origins = args.flatten.reject{ |s| s == '' }.map do |n|
274
274
  case n
275
- when Regexp,
275
+ when Proc,
276
+ Regexp,
276
277
  /^https?:\/\//,
277
278
  'file://' then n
278
279
  when '*' then @public_resources = true; n
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Cors
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -90,6 +90,15 @@ describe Rack::Cors do
90
90
  successful_cors_request '/proc-origin', :origin => 'http://10.10.10.10:3000'
91
91
  end
92
92
 
93
+ it 'should support lambda origin configuration' do
94
+ successful_cors_request '/lambda-origin', :origin => 'http://10.10.10.10:3000'
95
+ end
96
+
97
+ it 'should support proc origins configuration (inverse)' do
98
+ cors_request '/proc-origin', :origin => 'http://bad.guy'
99
+ last_response.wont_render_cors_success
100
+ end
101
+
93
102
  it 'should not mix up path rules across origins' do
94
103
  header 'Origin', 'http://10.10.10.10:3000'
95
104
  get '/' # / is configured in a separate rule block
@@ -32,6 +32,11 @@ use Rack::Cors do
32
32
  resource '/proc-origin'
33
33
  end
34
34
 
35
+ allow do
36
+ origins -> (source, env) { source.end_with?("10.10.10.10:3000") }
37
+ resource '/lambda-origin'
38
+ end
39
+
35
40
  allow do
36
41
  origins '*'
37
42
  resource '/public'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calvin Yu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-15 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler