cloudflare-rails 2.2.0 → 2.4.0

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
  SHA256:
3
- metadata.gz: 84dc9aec556073a4d870a4784e841e63f8a047ade776f55646617d90ae57a350
4
- data.tar.gz: b2d3411fae45afc2e4f9586dc3c9fddd966c2dab028fdef278a2e57e2fb11cca
3
+ metadata.gz: 11110e82a65bdac6452690a323d9f7b834ec61d224dce3584d59244ae5150240
4
+ data.tar.gz: cbbd90760e1966e42d0ae0e59526228686222a0b2381deb3d41680d4e05d227e
5
5
  SHA512:
6
- metadata.gz: 77da9de7361192e828223e3ee2da7213e8f502971b2bb503f8454e14210233bbabab107dce472d8477b0ef123bb389a8fc31b07fe0bc54d41ccbd5f0312fd474
7
- data.tar.gz: 5581a9d55303a8ec303e2e95497d87c20a973ae451f0a38bee98310dffb0d5b408d43b773808c7258acd7ad2c7a657638e874fb67a1d2c1df2bafd54a910eb72
6
+ metadata.gz: 55dad9534a826670be89601a3404d420535b92e42639e44a001e2f869711c3e7347b2d810ef00967d5f51f680e0517d0c856aa26c1caff8531988722fef00910
7
+ data.tar.gz: 45000db30d0f95515c7d69a4295a4f69d68b2285c638a24b4f1d30b79c53aa5940beb861b7dcc9c2cc75183ab039baaedc34f84510c5455abf7b68d46cc76379
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.4.0] - 2022-02-22
8
+ - Add trailing slashes to reflect Cloudflare API URLs (https://github.com/modosc/cloudflare-rails/pull/53)
9
+
10
+ ## [2.3.0] - 2021-10-22
11
+ - Better handling of malformed IP addresses (https://github.com/modosc/cloudflare-rails/pull/49)
12
+
7
13
  ## [2.2.0] - 2021-06-11
8
14
  - Fix typo in `actionpack` dependency
9
15
 
data/Gemfile CHANGED
@@ -2,7 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cloudflare-rails.gemspec
4
4
  gemspec
5
-
6
- group :development do
7
- gem "rspec-isolation", git: "https://github.com/modosc/rspec-isolation"
8
- end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cloudflare::Rails [![Gem Version](https://badge.fury.io/rb/cloudflare-rails.svg)](https://badge.fury.io/rb/cloudflare-rails) [![CircleCI](https://circleci.com/gh/modosc/cloudflare-rails/tree/master.svg?style=shield)](https://circleci.com/gh/modosc/cloudflare-rails/tree/master)
1
+ # Cloudflare::Rails [![Gem Version](https://badge.fury.io/rb/cloudflare-rails.svg)](https://badge.fury.io/rb/cloudflare-rails) [![CircleCI](https://circleci.com/gh/modosc/cloudflare-rails/tree/main.svg?style=shield)](https://circleci.com/gh/modosc/cloudflare-rails/tree/main)
2
2
  This gem correctly configures Rails for [CloudFlare](https://www.cloudflare.com) so that `request.remote_ip` / `request.ip` both work correctly.
3
3
 
4
4
  ## Rails Compatibility
@@ -4,8 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 5.2.0"
6
6
 
7
- group :development do
8
- gem "rspec-isolation", git: "https://github.com/modosc/rspec-isolation"
9
- end
10
-
11
7
  gemspec path: "../"
@@ -4,8 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 6.0.0"
6
6
 
7
- group :development do
8
- gem "rspec-isolation", git: "https://github.com/modosc/rspec-isolation"
9
- end
10
-
11
7
  gemspec path: "../"
@@ -4,8 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 6.1.0"
6
6
 
7
- group :development do
8
- gem "rspec-isolation", git: "https://github.com/modosc/rspec-isolation"
9
- end
10
-
11
7
  gemspec path: "../"
@@ -4,8 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", git: "https://github.com/rails/rails", branch: "main"
6
6
 
7
- group :development do
8
- gem "rspec-isolation", git: "https://github.com/modosc/rspec-isolation"
9
- end
10
-
11
7
  gemspec path: "../"
@@ -7,7 +7,13 @@ module Cloudflare
7
7
  # correct inside of rack and rails
8
8
  module CheckTrustedProxies
9
9
  def trusted_proxy?(ip)
10
- ::Rails.application.config.cloudflare.ips.any? { |proxy| proxy === ip } || super
10
+ matching = ::Rails.application.config.cloudflare.ips.any? do |proxy|
11
+ begin
12
+ proxy === ip
13
+ rescue IPAddr::InvalidAddressError
14
+ end
15
+ end
16
+ matching || super
11
17
  end
12
18
  end
13
19
 
@@ -37,8 +43,8 @@ module Cloudflare
37
43
  end
38
44
 
39
45
  BASE_URL = 'https://www.cloudflare.com'.freeze
40
- IPS_V4_URL = '/ips-v4'.freeze
41
- IPS_V6_URL = '/ips-v6'.freeze
46
+ IPS_V4_URL = '/ips-v4/'.freeze
47
+ IPS_V6_URL = '/ips-v6/'.freeze
42
48
 
43
49
  class << self
44
50
  def ips_v6
@@ -1,5 +1,5 @@
1
1
  module Cloudflare
2
2
  module Rails
3
- VERSION = "2.2.0".freeze
3
+ VERSION = "2.4.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jonathan schatz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -224,7 +224,6 @@ files:
224
224
  - ".rubocop.yml"
225
225
  - ".rubocop_airbnb.yml"
226
226
  - ".rubocop_todo.yml"
227
- - ".travis.yml"
228
227
  - Appraisals
229
228
  - CHANGELOG.md
230
229
  - Gemfile
@@ -261,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
260
  - !ruby/object:Gem::Version
262
261
  version: '0'
263
262
  requirements: []
264
- rubygems_version: 3.2.18
263
+ rubygems_version: 3.2.22
265
264
  signing_key:
266
265
  specification_version: 4
267
266
  summary: This gem configures Rails for CloudFlare so that request.ip and request.remote_ip
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6