safe_redirect 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 846ca148f882664845dd48c74c4b210b09101554
|
4
|
+
data.tar.gz: fb1a59ccad4d4065ecffcbe5777150f07f657919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c89105fbf5b35697f8182b74a50a46863bd43f30e4c78f8d0cd8b4e800b952ce9892528f9abfd7cc6fc75ffc2afe62292845c216b26f3b99857954259f388ca
|
7
|
+
data.tar.gz: f52475eb7900bc3872dff9da34a89258ad0f0b486efcd67b623568edfdf25a0dbdcb41d545de16576bb0b2577a225a6270ca75225c2563ecf91d1fe7ca0252f8
|
@@ -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!(/^((https?:|data:|javascript:|\.|\/\/|@|%
|
32
|
+
stripped_path.gsub!(/^((https?:|data:|javascript:|\.|\/\/|@|%)+[a-z0-9\-\.:@%]*)+/i, '')
|
33
33
|
end
|
34
34
|
stripped_path.empty? ? '/' : stripped_path
|
35
35
|
end
|
@@ -67,6 +67,19 @@ module SafeRedirect
|
|
67
67
|
expect(Controller.safe_path('http://////@@@@@@attacker.com//evil.com')).to eq('/')
|
68
68
|
end
|
69
69
|
|
70
|
+
it "considers //bukalapak.com%25%40%25%40%25%40%25%40%25%40%25%40%25%40evil.com an unsafe path" do
|
71
|
+
expect(Controller.safe_path('//bukalapak.com%25%40%25%40%25%40%25%40%25%40%25%40%25%40evil.com')).to eq('/')
|
72
|
+
end
|
73
|
+
|
74
|
+
it "considers %25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40evil.com an unsafe path" do
|
75
|
+
expect(Controller.safe_path('%25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40%25%40evil.com')).to eq('/')
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
it "considers %@%@%@%@%@%@%@%@%@%@evil.com an unsafe path" do
|
80
|
+
expect(Controller.safe_path('%@%@%@%@%@%@%@%@%@%@evil.com')).to eq('/')
|
81
|
+
end
|
82
|
+
|
70
83
|
it "can use redirect_to method with only the target path" do
|
71
84
|
Controller.redirect_to '/'
|
72
85
|
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.9
|
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-06-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|