ruby-proxy-headers 0.2.2 → 0.2.3
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 227e0393d4ab8a6f03fa72d69541f07a20c73cec9eb3458266dbaa0b74fee36d
|
|
4
|
+
data.tar.gz: 299ef710e77b061929ce18159f37e82f002c7a8522b5f0c5ed4319f3d2ab517f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: deae95ea2297961bc962a5d9e476ec09b88c85a6a2ac741e1c5d1cb15972f1dc096f2b52e16a70aaca28a77ce04568f00a1109abd2edbdfee45a9727841bff61
|
|
7
|
+
data.tar.gz: 55096cb62498dc26f1c1695c8bc46213db91bea6be4c2d056af152cdbbabd07873bc646c2db07a2e36764f8cd8a78188942c77d15b784c3c71acc3e91e2f8a75
|
|
@@ -135,14 +135,7 @@ module RubyProxyHeaders
|
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def validate_connect_target!(host, port)
|
|
138
|
-
|
|
139
|
-
raise ArgumentError,
|
|
140
|
-
"CONNECT target host contains invalid characters (CR, LF, or NUL): #{host.inspect}"
|
|
141
|
-
end
|
|
142
|
-
if RubyProxyHeaders::INVALID_HEADER_VALUE_RE.match?(port.to_s)
|
|
143
|
-
raise ArgumentError,
|
|
144
|
-
"CONNECT target port contains invalid characters (CR, LF, or NUL): #{port.inspect}"
|
|
145
|
-
end
|
|
138
|
+
RubyProxyHeaders.validate_connect_target!(host, port)
|
|
146
139
|
end
|
|
147
140
|
|
|
148
141
|
def raise_connect_error
|
|
@@ -48,6 +48,12 @@ module RubyProxyHeaders
|
|
|
48
48
|
@ssl_context = OpenSSL::SSL::SSLContext.new
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
if use_ssl? && proxy?
|
|
52
|
+
# Fail before any socket I/O: CONNECT interpolates these into a raw request line.
|
|
53
|
+
RubyProxyHeaders.validate_connect_target!(conn_address, @port)
|
|
54
|
+
RubyProxyHeaders.validate_connect_target!(@address, @port)
|
|
55
|
+
end
|
|
56
|
+
|
|
51
57
|
if proxy?
|
|
52
58
|
conn_addr = proxy_address
|
|
53
59
|
conn_port = proxy_port
|
data/lib/ruby_proxy_headers.rb
CHANGED
|
@@ -22,4 +22,17 @@ module RubyProxyHeaders
|
|
|
22
22
|
raise ArgumentError, "proxy CONNECT header value contains invalid characters (CR, LF, or NUL): #{value.inspect}"
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
# Raises ArgumentError if +host+ or +port+ contain CR, LF, or NUL bytes that
|
|
27
|
+
# would allow HTTP request smuggling when interpolated into a CONNECT line.
|
|
28
|
+
def self.validate_connect_target!(host, port)
|
|
29
|
+
if INVALID_HEADER_VALUE_RE.match?(host.to_s)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"CONNECT target host contains invalid characters (CR, LF, or NUL): #{host.inspect}"
|
|
32
|
+
end
|
|
33
|
+
if INVALID_HEADER_VALUE_RE.match?(port.to_s)
|
|
34
|
+
raise ArgumentError,
|
|
35
|
+
"CONNECT target port contains invalid characters (CR, LF, or NUL): #{port.inspect}"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
25
38
|
end
|