safe_redirect 0.1.5 → 0.1.6
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83594e7e226d3e60888b702e5b78913e5608f048
|
|
4
|
+
data.tar.gz: b28b74779ef487115be6eeb9b64f4aae8e1855cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffe4d06d9859fccd5cfd52e84e04bbb03351b50f77a202293c187601395c58b37e5cd360be776bc7ff360562051eabf6930f0440729a91e0a348c1b441b4ba0d
|
|
7
|
+
data.tar.gz: 375f867f4049e2ae31777a318e58d70da3d5a17a25129dc9821a073d6cfc9c30570572acab67bc5e1fbe80761b2569ae1f17af0a1db02458ed0e7916055c433a
|
|
@@ -29,7 +29,7 @@ module SafeRedirect
|
|
|
29
29
|
stripped_path = path.strip
|
|
30
30
|
unless safe_domain?(stripped_path)
|
|
31
31
|
stripped_path.gsub!(/https?:\/\/[a-z0-9\-\.:@]*/i, '')
|
|
32
|
-
stripped_path.gsub!(/^(data:|javascript:|\.|\/\/|@)+[a-z0-9\-\.:@]
|
|
32
|
+
stripped_path.gsub!(/^((https?:|data:|javascript:|\.|\/\/|@)+[a-z0-9\-\.:@]*)+/i, '')
|
|
33
33
|
end
|
|
34
34
|
stripped_path.empty? ? '/' : stripped_path
|
|
35
35
|
end
|
|
@@ -63,6 +63,10 @@ module SafeRedirect
|
|
|
63
63
|
expect(Controller.safe_path('.@@@google.com/search')).to eq('/search')
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
it "considers http://////@@@@@@attacker.com//evil.com an unsafe path" do
|
|
67
|
+
expect(Controller.safe_path('http://////@@@@@@attacker.com//evil.com')).to eq('/')
|
|
68
|
+
end
|
|
69
|
+
|
|
66
70
|
it "can use redirect_to method with only the target path" do
|
|
67
71
|
Controller.redirect_to '/'
|
|
68
72
|
end
|
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.1.
|
|
4
|
+
version: 0.1.6
|
|
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-05-
|
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|