diff --git a/.rubocop.yml b/.rubocop.yml index dd54da9b5f..ffa694f74a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,7 +21,7 @@ AllCops: - 'db/schema.rb' - 'vendor/bundle/**/*' NewCops: enable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 Rails: Enabled: true diff --git a/Gemfile b/Gemfile index a81f5175b1..1265083b19 100644 --- a/Gemfile +++ b/Gemfile @@ -28,9 +28,6 @@ gem "non-digest-assets", "~> 1.0" gem "rake", "~> 13.0" gem "reverse_markdown", "~> 2.0" -# Force minimum nokogiri version to avoid security issues -gem "nokogiri", ">= 1.12.5" - # Force older sprockets gem "sprockets", "~> 3.0" diff --git a/publify_amazon_sidebar/.rubocop.yml b/publify_amazon_sidebar/.rubocop.yml index 3ea4d335bd..5c0ac18a6d 100644 --- a/publify_amazon_sidebar/.rubocop.yml +++ b/publify_amazon_sidebar/.rubocop.yml @@ -9,7 +9,7 @@ AllCops: - 'spec/dummy/bin/*' - 'spec/dummy/db/schema.rb' NewCops: enable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 Rails: Enabled: true diff --git a/publify_amazon_sidebar/publify_amazon_sidebar.gemspec b/publify_amazon_sidebar/publify_amazon_sidebar.gemspec index 373c79db97..7c770f8cff 100644 --- a/publify_amazon_sidebar/publify_amazon_sidebar.gemspec +++ b/publify_amazon_sidebar/publify_amazon_sidebar.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.description = "Amazon sidebar for the Publify blogging system." s.license = "MIT" - s.required_ruby_version = ">= 2.4.0" + s.required_ruby_version = ">= 2.5.0" s.files = File.open("Manifest.txt").readlines.map(&:chomp) diff --git a/publify_core/.rubocop.yml b/publify_core/.rubocop.yml index ccc51de4ff..94d69d8e73 100644 --- a/publify_core/.rubocop.yml +++ b/publify_core/.rubocop.yml @@ -9,7 +9,7 @@ AllCops: - 'spec/dummy/bin/*' - 'spec/dummy/db/schema.rb' NewCops: enable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 Rails: Enabled: true diff --git a/publify_core/lib/spam_protection.rb b/publify_core/lib/spam_protection.rb index 64bc222d31..237b251d50 100644 --- a/publify_core/lib/spam_protection.rb +++ b/publify_core/lib/spam_protection.rb @@ -82,16 +82,14 @@ def scan_uris(uris = []) def query_rbls(rbls, *subdomains) rbls.each do |rbl| subdomains.uniq.each do |d| - begin - response = IPSocket.getaddress([d, rbl].join(".")) - if response.start_with?("127.0.0.") - throw :hit, - "#{rbl} positively resolved subdomain #{d} => #{response}" - end - rescue SocketError - # NXDOMAIN response => negative: d is not in RBL - next + response = IPSocket.getaddress([d, rbl].join(".")) + if response.start_with?("127.0.0.") + throw :hit, + "#{rbl} positively resolved subdomain #{d} => #{response}" end + rescue SocketError + # NXDOMAIN response => negative: d is not in RBL + next end end false diff --git a/publify_core/publify_core.gemspec b/publify_core/publify_core.gemspec index f831d47974..cb458f15d0 100644 --- a/publify_core/publify_core.gemspec +++ b/publify_core/publify_core.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.files = File.open("Manifest.txt").readlines.map(&:chomp) - s.required_ruby_version = ">= 2.4.0" + s.required_ruby_version = ">= 2.5.0" s.add_dependency "aasm", "~> 5.0" s.add_dependency "akismet", "~> 3.0" @@ -35,6 +35,8 @@ Gem::Specification.new do |s| s.add_dependency "jquery-ui-rails", "~> 6.0.1" s.add_dependency "kaminari", ["~> 1.2", ">= 1.2.1"] s.add_dependency "mini_magick", ["~> 4.9", ">= 4.9.4"] + # Force minimum nokogiri version to avoid security issues + s.add_dependency "nokogiri", ">= 1.12.5" s.add_dependency "rack", ">= 2.2.3" s.add_dependency "rails", "~> 5.2.6" s.add_dependency "rails_autolink", "~> 1.1.0" diff --git a/publify_core/spec/helpers/base_helper_spec.rb b/publify_core/spec/helpers/base_helper_spec.rb index 0b8563c283..829bd3b7e6 100644 --- a/publify_core/spec/helpers/base_helper_spec.rb +++ b/publify_core/spec/helpers/base_helper_spec.rb @@ -121,29 +121,25 @@ def parse_request(_contents, _request_params) end it "returns a link with the creation date and time" do - begin - timezone = Time.zone - Time.zone = "UTC" - - expect(get_reply_context_twitter_link(reply)). - to eq '' \ - "23/01/2014 at 13h47" - ensure - Time.zone = timezone - end + timezone = Time.zone + Time.zone = "UTC" + + expect(get_reply_context_twitter_link(reply)). + to eq '' \ + "23/01/2014 at 13h47" + ensure + Time.zone = timezone end it "displays creation date and time in the current time zone" do - begin - timezone = Time.zone - Time.zone = "Tokyo" - - expect(get_reply_context_twitter_link(reply)). - to eq '' \ - "23/01/2014 at 22h47" - ensure - Time.zone = timezone - end + timezone = Time.zone + Time.zone = "Tokyo" + + expect(get_reply_context_twitter_link(reply)). + to eq '' \ + "23/01/2014 at 22h47" + ensure + Time.zone = timezone end end diff --git a/publify_textfilter_code/.rubocop.yml b/publify_textfilter_code/.rubocop.yml index 986ee26d9f..0918d7bffb 100644 --- a/publify_textfilter_code/.rubocop.yml +++ b/publify_textfilter_code/.rubocop.yml @@ -9,7 +9,7 @@ AllCops: - 'spec/dummy/bin/*' - 'spec/dummy/db/schema.rb' NewCops: enable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 Rails: Enabled: true diff --git a/publify_textfilter_code/lib/publify_app/textfilter_code.rb b/publify_textfilter_code/lib/publify_app/textfilter_code.rb index 28d1771536..094fa03fdc 100644 --- a/publify_textfilter_code/lib/publify_app/textfilter_code.rb +++ b/publify_textfilter_code/lib/publify_app/textfilter_code.rb @@ -50,7 +50,7 @@ def self.macrofilter(attrib, text = "") DEFAULT_OPTIONS end - text = text.to_s.delete("\r").gsub(/\A\n/, "").chomp + text = text.to_s.delete("\r").delete_prefix("\n").chomp begin text = CodeRay.scan(text, lang.downcase.to_sym).span(options) diff --git a/publify_textfilter_code/publify_textfilter_code.gemspec b/publify_textfilter_code/publify_textfilter_code.gemspec index da949325c2..2a0b251e11 100644 --- a/publify_textfilter_code/publify_textfilter_code.gemspec +++ b/publify_textfilter_code/publify_textfilter_code.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.files = File.open("Manifest.txt").readlines.map(&:chomp) - s.required_ruby_version = ">= 2.4.0" + s.required_ruby_version = ">= 2.5.0" s.add_dependency "coderay", "~> 1.1.0" s.add_dependency "htmlentities", "~> 4.3"