private_address_check 0.2.0 → 0.3.0

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

Potentially problematic release.


This version of private_address_check might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a083cb52ac474ff6cf8ce66319809d17fa577fa3
4
- data.tar.gz: 48f618961a48b3af93a1c1985b50538bcc1edaff
3
+ metadata.gz: 5f750421b67d8f9d5861789e88497b7e46f7bd33
4
+ data.tar.gz: 2e164ad6417171f6d8a0dbf422ba763405cfd9d8
5
5
  SHA512:
6
- metadata.gz: 66da1452e9f52d5ae201a8717d13142589f5df45562815755a169fcacd028be29f18e6ecedd66530ef8139852331d3f4ca8645b90d338cca0d91b3078ec8bb60
7
- data.tar.gz: 36c62e3ab8a039711793fa6bd1ea655942d4dec9a03bb863c21f561ebb1fe00d1e73402e69d8bf58ecebabc753f701add6201fdc8f8145e35460ce0ea96a37e3
6
+ metadata.gz: 9ecd76ef8c342278660b208921604e9b32a620922674455816d925c54383fe6ad6e191d15788703c81d6b66bb580fd7a1123cd1bdd341ce25898e31950c5c304
7
+ data.tar.gz: 69765c55512fda3ba4e130c8e7e0152c4817edb7705a5e5d849f6d767cba635599f625bbbd15e3420a451c16e256962da78c4e43cd3972f78912886483b5ef2f
@@ -9,20 +9,16 @@ module PrivateAddressCheck
9
9
  ensure
10
10
  Thread.current[:private_address_check] = false
11
11
  end
12
+ end
12
13
 
13
- module TCPSocketExt
14
- def initialize(remote_host, remote_port, local_host = nil, local_port = nil)
15
- if Thread.current[:private_address_check]
16
- if PrivateAddressCheck.resolves_to_private_address?(remote_host)
17
- raise PrivateAddressCheck::PrivateConnectionAttemptedError
18
- end
14
+ TCPSocket.class_eval do
15
+ alias initialize_without_private_address_check initialize
19
16
 
20
- super(remote_host, remote_port, local_host, local_port)
21
- else
22
- super
23
- end
17
+ def initialize(remote_host, remote_port, local_host = nil, local_port = nil)
18
+ if Thread.current[:private_address_check] && PrivateAddressCheck.resolves_to_private_address?(remote_host)
19
+ raise PrivateAddressCheck::PrivateConnectionAttemptedError
24
20
  end
21
+
22
+ initialize_without_private_address_check(remote_host, remote_port, local_host, local_port)
25
23
  end
26
24
  end
27
-
28
- TCPSocket.send(:prepend, PrivateAddressCheck::TCPSocketExt)
@@ -1,3 +1,3 @@
1
1
  module PrivateAddressCheck
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: private_address_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Downey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.5.1
94
+ rubygems_version: 2.6.8
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Prevent Server Side Request Forgery attacks by checking the destination