safe_redirect 0.2.3 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e0bbcba98a1e205b970a2350ad00ee249c29179
4
- data.tar.gz: d83b859f1a3dff81021f1b3fa7b872e7592f262e
3
+ metadata.gz: 336f84a6b03db00df68f1f76be936b3e199cd829
4
+ data.tar.gz: f65b82666b23abce9eeb46e310aef4526ca9d5f1
5
5
  SHA512:
6
- metadata.gz: 421f582d00d284e2229790a0a63761a3eb1794cab6ac68435f1d68f378619ee47f08495cab470f962016ad568cdaa1408b3187be13133396ed20355186263897
7
- data.tar.gz: 430412ac48189ac16692c3e78e70ef4bac43523e67f33efcae09ab61f49bf9a9a36854d877ebf7dce681323f972a57126e230b05bb0e47ae09b4004688bd7f32
6
+ metadata.gz: e8c77143c12ec4d810fa92554dd22fb7277aaad3552b927b3dc817565b5a0996ffabcd299cb968a5f7a82df8f4210934d71178a8092b79b46d0774aebf81d3f6
7
+ data.tar.gz: 50d512e6af84ad7353914b1406eacc80208f5874d9787edbea9707afc49415081b6702e6953f1537a1c1c6000188ad6e0ffc8d83638f8beb4169f3648bcaf632
@@ -47,7 +47,7 @@ module SafeRedirect
47
47
 
48
48
  def clean_path(path)
49
49
  uri = URI.parse(path)
50
- safe_domain?(uri) ? path : SafeRedirect.configuration.default_path
50
+ valid_path?(path) && safe_domain?(uri) ? path : SafeRedirect.configuration.default_path
51
51
  rescue URI::InvalidURIError
52
52
  SafeRedirect.configuration.default_path
53
53
  end
@@ -66,4 +66,8 @@ module SafeRedirect
66
66
  false
67
67
  end
68
68
 
69
+ def valid_path?(path)
70
+ path !~ /\/\/\//
71
+ end
72
+
69
73
  end
@@ -1,3 +1,3 @@
1
1
  module SafeRedirect
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -33,6 +33,7 @@ module SafeRedirect
33
33
  "https://www-bukalapak.com",
34
34
  "https://www.bukalapak.com\n.evil.com",
35
35
  "http://blah.blah.foo.org",
36
+ "///bit.ly/1hqE77G",
36
37
  ]
37
38
 
38
39
  SAFE_PATHS.each do |path|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_redirect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin Tunggawan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-14 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec