fix more insecure protocols

This commit is contained in:
Reto Kromer 2018-08-06 16:50:42 +02:00
parent d630f0885b
commit 456571b15d
12 changed files with 61 additions and 61 deletions

View File

@ -31,7 +31,7 @@ describe Hbc::Artifact::App, :cask do
let(:cask) {
Hbc::Cask.new("subdir") do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "http://example.com/local-caffeine"
homepage "https://example.com/local-caffeine"
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
app "subdir/Caffeine.app", target: "AnotherName.app"

View File

@ -26,7 +26,7 @@ describe Hbc::Artifact::App, :cask do
let(:cask) {
Hbc::Cask.new("subdir") do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "http://example.com/local-caffeine"
homepage "https://example.com/local-caffeine"
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
app "subdir/Caffeine.app"

View File

@ -12,8 +12,8 @@ describe Hbc::CLI::Cat, :cask do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
url 'http://example.com/TestCask.dmg'
homepage 'http://example.com/'
url 'https://example.com/TestCask.dmg'
homepage 'https://example.com/'
app 'TestCask.app'
end

View File

@ -8,13 +8,13 @@ describe Hbc::CLI::Home, :cask do
it_behaves_like "a command that handles invalid options"
it "opens the homepage for the specified Cask" do
expect(described_class).to receive(:open_url).with("http://example.com/local-caffeine")
expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine")
described_class.run("local-caffeine")
end
it "works for multiple Casks" do
expect(described_class).to receive(:open_url).with("http://example.com/local-caffeine")
expect(described_class).to receive(:open_url).with("http://example.com/local-transmission")
expect(described_class).to receive(:open_url).with("https://example.com/local-caffeine")
expect(described_class).to receive(:open_url).with("https://example.com/local-transmission")
described_class.run("local-caffeine", "local-transmission")
end

View File

@ -10,7 +10,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("local-caffeine")
}.to output(<<~EOS).to_stdout
local-caffeine: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb
==> Name
@ -25,7 +25,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("with-auto-updates")
}.to output(<<~EOS).to_stdout
with-auto-updates: 1.0 (auto_updates)
http://example.com/autoupdates
https://example.com/autoupdates
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-auto-updates.rb
==> Name
@ -39,7 +39,7 @@ describe Hbc::CLI::Info, :cask do
let(:expected_output) {
<<~EOS
local-caffeine: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-caffeine.rb
==> Name
@ -47,7 +47,7 @@ describe Hbc::CLI::Info, :cask do
==> Artifacts
Caffeine.app (App)
local-transmission: 2.61
http://example.com/local-transmission
https://example.com/local-transmission
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/local-transmission.rb
==> Name
@ -69,7 +69,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("with-caveats")
}.to output(<<~EOS).to_stdout
with-caveats: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-caveats.rb
==> Name
@ -95,7 +95,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("with-conditional-caveats")
}.to output(<<~EOS).to_stdout
with-conditional-caveats: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-conditional-caveats.rb
==> Name
@ -110,7 +110,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("with-languages")
}.to output(<<~EOS).to_stdout
with-languages: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-languages.rb
==> Name
@ -127,7 +127,7 @@ describe Hbc::CLI::Info, :cask do
described_class.run("without-languages")
}.to output(<<~EOS).to_stdout
without-languages: 1.2.3
http://example.com/local-caffeine
https://example.com/local-caffeine
Not installed
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/without-languages.rb
==> Name

View File

@ -3,7 +3,7 @@ describe Hbc::CLI::InternalStanza, :cask do
command = described_class.new("gpg", "with-gpg")
expect {
command.run
}.to output("http://example.com/gpg-signature.asc\n").to_stdout
}.to output("https://example.com/gpg-signature.asc\n").to_stdout
end
it "raises an exception when stanza is unknown/unsupported" do

View File

@ -1,5 +1,5 @@
describe "download strategies", :cask do
let(:url) { "http://example.com/cask.dmg" }
let(:url) { "https://example.com/cask.dmg" }
let(:url_options) { {} }
let(:cask) {
instance_double(Hbc::Cask, token: "some-cask",
@ -16,7 +16,7 @@ describe "download strategies", :cask do
it "properly assigns a name and uri based on the Cask" do
expect(downloader.name).to eq("some-cask")
expect(downloader.url).to eq("http://example.com/cask.dmg")
expect(downloader.url).to eq("https://example.com/cask.dmg")
expect(downloader.version.to_s).to eq("1.2.3.4")
end
@ -82,7 +82,7 @@ describe "download strategies", :cask do
end
context "with referer set" do
let(:url_options) { { referer: "http://somehost/also" } }
let(:url_options) { { referer: "https://somehost/also" } }
it "adds curl args for referer" do
curl_args = []
@ -90,7 +90,7 @@ describe "download strategies", :cask do
downloader.fetch
expect(curl_args.each_cons(2)).to include(["-e", "http://somehost/also"])
expect(curl_args.each_cons(2)).to include(["-e", "https://somehost/also"])
end
end
@ -103,7 +103,7 @@ describe "download strategies", :cask do
end
context "with no discernible file name in it" do
let(:url) { "http://example.com/download" }
let(:url) { "https://example.com/download" }
describe "#tarball_path" do
subject { downloader.tarball_path }
@ -113,7 +113,7 @@ describe "download strategies", :cask do
end
context "with a file name trailing the first query parameter" do
let(:url) { "http://example.com/download?file=cask.zip&a=1" }
let(:url) { "https://example.com/download?file=cask.zip&a=1" }
describe "#tarball_path" do
subject { downloader.tarball_path }
@ -123,7 +123,7 @@ describe "download strategies", :cask do
end
context "with a file name trailing the second query parameter" do
let(:url) { "http://example.com/dl?a=1&file=cask.zip&b=2" }
let(:url) { "https://example.com/dl?a=1&file=cask.zip&b=2" }
describe "#tarball_path" do
subject { downloader.tarball_path }

View File

@ -3,13 +3,13 @@ require "cmd/cask"
describe Hbc::DSL::Appcast do
subject { described_class.new(url, params) }
let(:url) { "http://example.com" }
let(:url) { "https://example.com" }
let(:uri) { URI(url) }
let(:params) { {} }
describe "#to_s" do
it "returns the parsed URI string" do
expect(subject.to_s).to eq("http://example.com")
expect(subject.to_s).to eq("https://example.com")
end
end

View File

@ -4,8 +4,8 @@ describe Hbc::DSL, :cask do
context "stanzas" do
it "lets you set url, homepage, and version" do
expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
expect(cask.homepage).to eq("http://example.com/")
expect(cask.url.to_s).to eq("https://example.com/TestCask.dmg")
expect(cask.homepage).to eq("https://example.com/")
expect(cask.version.to_s).to eq("1.2.3")
end
end
@ -65,8 +65,8 @@ describe Hbc::DSL, :cask do
it "does not require a DSL version in the header" do
expect(cask.token).to eq("no-dsl-version")
expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
expect(cask.homepage).to eq("http://example.com/")
expect(cask.url.to_s).to eq("https://example.com/TestCask.dmg")
expect(cask.homepage).to eq("https://example.com/")
expect(cask.version.to_s).to eq("1.2.3")
end
end

View File

@ -31,7 +31,7 @@ module Homebrew
specify "simple valid Formula" do
ft = formula_text "valid", <<~RUBY
url "http://www.example.com/valid-1.0.tar.gz"
url "https://www.example.com/valid-1.0.tar.gz"
RUBY
expect(ft).not_to have_data
@ -80,7 +80,7 @@ module Homebrew
it "is empty by default" do
fa = formula_auditor "foo", <<~RUBY
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
RUBY
@ -94,7 +94,7 @@ module Homebrew
fa = formula_auditor "foo", <<~RUBY
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
RUBY
@ -109,7 +109,7 @@ module Homebrew
specify "DATA but no __END__" do
fa = formula_auditor "foo", <<~RUBY
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
patch :DATA
end
RUBY
@ -121,7 +121,7 @@ module Homebrew
specify "__END__ but no DATA" do
fa = formula_auditor "foo", <<~RUBY
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
__END__
a patch goes here
@ -141,8 +141,8 @@ module Homebrew
specify "no issue" do
fa = formula_auditor "foo", <<~RUBY
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
homepage "http://example.com"
url "https://example.com/foo-1.0.tgz"
homepage "https://example.com"
end
RUBY
@ -155,7 +155,7 @@ module Homebrew
specify "pkgshare" do
fa = formula_auditor "foo", <<~RUBY, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
RUBY
@ -188,7 +188,7 @@ module Homebrew
fa = formula_auditor "foolibc++", <<~RUBY, strict: true
class Foolibcxx < Formula
desc "foolibc++ is a test"
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
RUBY
@ -209,7 +209,7 @@ module Homebrew
fa = formula_auditor "foo", <<~RUBY, strict: true, online: true
class Foo < Formula
homepage "https://github.com/example/example"
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
end
RUBY
@ -226,8 +226,8 @@ module Homebrew
let(:fa) do
formula_auditor "foo", <<~RUBY, new_formula: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
homepage "http://example.com"
url "https://example.com/foo-1.0.tgz"
homepage "https://example.com"
depends_on "openssl"
end
@ -236,8 +236,8 @@ module Homebrew
let(:f_openssl) do
formula do
url "http://example.com/openssl-1.0.tgz"
homepage "http://example.com"
url "https://example.com/openssl-1.0.tgz"
homepage "https://example.com"
keg_only :provided_by_macos
end
@ -258,8 +258,8 @@ module Homebrew
let(:fa) do
formula_auditor "foo", <<~RUBY, new_formula: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
homepage "http://example.com"
url "https://example.com/foo-1.0.tgz"
homepage "https://example.com"
depends_on "bc"
end
@ -268,8 +268,8 @@ module Homebrew
let(:f_bc) do
formula do
url "http://example.com/bc-1.0.tgz"
homepage "http://example.com"
url "https://example.com/bc-1.0.tgz"
homepage "https://example.com"
keg_only :provided_by_macos
end
@ -290,7 +290,7 @@ module Homebrew
specify "keg_only_needs_downcasing" do
fa = formula_auditor "foo", <<~RUBY, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
keg_only "Because why not"
end
@ -304,7 +304,7 @@ module Homebrew
specify "keg_only_redundant_period" do
fa = formula_auditor "foo", <<~RUBY, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
keg_only "because this line ends in a period."
end
@ -318,7 +318,7 @@ module Homebrew
specify "keg_only_handles_block_correctly" do
fa = formula_auditor "foo", <<~RUBY, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
keg_only <<~EOF
this line starts with a lowercase word.
@ -337,7 +337,7 @@ module Homebrew
specify "keg_only_handles_whitelist_correctly" do
fa = formula_auditor "foo", <<~RUBY, strict: true
class Foo < Formula
url "http://example.com/foo-1.0.tgz"
url "https://example.com/foo-1.0.tgz"
keg_only "Apple ships foo in the CLT package"
end

View File

@ -12,19 +12,19 @@ describe DependencyCollector do
context "when xz, unzip, and bzip2 are not available" do
it "creates a resource dependency from a '.xz' URL" do
resource.url("http://example.com/foo.xz")
resource.url("https://example.com/foo.xz")
allow_any_instance_of(Object).to receive(:which).with("xz")
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build]))
end
it "creates a resource dependency from a '.zip' URL" do
resource.url("http://example.com/foo.zip")
resource.url("https://example.com/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("unzip")
expect(subject.add(resource)).to eq(Dependency.new("unzip", [:build]))
end
it "creates a resource dependency from a '.bz2' URL" do
resource.url("http://example.com/foo.tar.bz2")
resource.url("https://example.com/foo.tar.bz2")
allow_any_instance_of(Object).to receive(:which).with("bzip2")
expect(subject.add(resource)).to eq(Dependency.new("bzip2", [:build]))
end
@ -32,19 +32,19 @@ describe DependencyCollector do
context "when xz, zip, and bzip2 are available" do
it "does not create a resource dependency from a '.xz' URL" do
resource.url("http://example.com/foo.xz")
resource.url("https://example.com/foo.xz")
allow_any_instance_of(Object).to receive(:which).with("xz").and_return(Pathname.new("foo"))
expect(subject.add(resource)).to be nil
end
it "does not create a resource dependency from a '.zip' URL" do
resource.url("http://example.com/foo.zip")
resource.url("https://example.com/foo.zip")
allow_any_instance_of(Object).to receive(:which).with("unzip").and_return(Pathname.new("foo"))
expect(subject.add(resource)).to be nil
end
it "does not create a resource dependency from a '.bz2' URL" do
resource.url("http://example.com/foo.tar.bz2")
resource.url("https://example.com/foo.tar.bz2")
allow_any_instance_of(Object).to receive(:which).with("bzip2").and_return(Pathname.new("foo"))
expect(subject.add(resource)).to be nil
end

View File

@ -25,26 +25,26 @@ describe DependencyCollector do
specify "Resource xz pre-Mavericks dependency" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
resource = Resource.new
resource.url("http://example.com/foo.tar.xz")
resource.url("https://example.com/foo.tar.xz")
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build]))
end
specify "Resource xz Mavericks or newer dependency" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9"))
resource = Resource.new
resource.url("http://example.com/foo.tar.xz")
resource.url("https://example.com/foo.tar.xz")
expect(subject.add(resource)).to be nil
end
specify "Resource dependency from a '.zip' URL" do
resource = Resource.new
resource.url("http://example.com/foo.zip")
resource.url("https://example.com/foo.zip")
expect(subject.add(resource)).to be nil
end
specify "Resource dependency from a '.bz2' URL" do
resource = Resource.new
resource.url("http://example.com/foo.tar.bz2")
resource.url("https://example.com/foo.tar.bz2")
expect(subject.add(resource)).to be nil
end