Skip to content

Commit

Permalink
[core] Remove obsolete and expired WWDR G1 certificate (#21271)
Browse files Browse the repository at this point in the history
Fixes #21269.
  • Loading branch information
triplef committed May 17, 2023
1 parent 5e0149b commit 8aed4cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
5 changes: 0 additions & 5 deletions fastlane_core/lib/fastlane_core/cert_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

# WWDR Intermediate Certificates in https://www.apple.com/certificateauthority/
WWDRCA_CERTIFICATES = [
{
alias: 'G1',
sha256: 'ce057691d730f89ca25e916f7335f4c8a15713dcd273a658c024023f8eb809c2',
url: 'https://developer.apple.com/certificationauthority/AppleWWDRCA.cer'
},
{
alias: 'G2',
sha256: '9ed4b3b88c6a339cf1387895bda9ca6ea31a6b5ce9edf7511845923b0c8ac94c',
Expand Down
13 changes: 4 additions & 9 deletions fastlane_core/spec/cert_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class ProcessStatusMock

describe '#installed_identies' do
it 'should print an error when no local code signing identities are found' do
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G1', 'G2', 'G3', 'G4', 'G5', 'G6'])
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G2', 'G3', 'G4', 'G5', 'G6'])
allow(FastlaneCore::CertChecker).to receive(:list_available_identities).and_return(" 0 valid identities found\n")
expect(FastlaneCore::UI).to receive(:error).with(/There are no local code signing identities found/)

FastlaneCore::CertChecker.installed_identies
end

it 'should not be fooled by 10 local code signing identities available' do
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G1', 'G2', 'G3', 'G4', 'G5', 'G6'])
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G2', 'G3', 'G4', 'G5', 'G6'])
allow(FastlaneCore::CertChecker).to receive(:list_available_identities).and_return(" 10 valid identities found\n")
expect(FastlaneCore::UI).not_to(receive(:error))

Expand Down Expand Up @@ -55,7 +55,6 @@ class ProcessStatusMock
describe '#install_missing_wwdr_certificates' do
it 'should install all official WWDR certificates' do
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return([])
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G1')
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G2')
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G3')
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G4')
Expand All @@ -66,17 +65,13 @@ class ProcessStatusMock

it 'should install the missing official WWDR certificate' do
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G2', 'G3', 'G4', 'G5'])
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G1')
expect(FastlaneCore::CertChecker).to receive(:install_wwdr_certificate).with('G6')
FastlaneCore::CertChecker.install_missing_wwdr_certificates
end

it 'should download the WWDR certificate from correct URL' do
allow(FastlaneCore::CertChecker).to receive(:wwdr_keychain).and_return('login.keychain')

expect(Open3).to receive(:capture3).with(include('https://developer.apple.com/certificationauthority/AppleWWDRCA.cer')).and_return(["", "", success_status])
FastlaneCore::CertChecker.install_wwdr_certificate('G1')

expect(Open3).to receive(:capture3).with(include('https://www.apple.com/certificateauthority/AppleWWDRCAG2.cer')).and_return(["", "", success_status])
FastlaneCore::CertChecker.install_wwdr_certificate('G2')

Expand Down Expand Up @@ -118,7 +113,7 @@ class ProcessStatusMock
expect(Open3).to receive(:capture3).with(cmd).and_return(["", "", success_status])
expect(FastlaneCore::CertChecker).to receive(:wwdr_keychain).and_return(keychain_name)

allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G1', 'G2', 'G3', 'G4', 'G5'])
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G2', 'G3', 'G4', 'G5'])
expect(FastlaneCore::CertChecker.install_missing_wwdr_certificates).to be(1)
end

Expand All @@ -135,7 +130,7 @@ class ProcessStatusMock
expect(Open3).to receive(:capture3).with(cmd).and_return(["", "", success_status])
expect(FastlaneCore::CertChecker).to receive(:wwdr_keychain).and_return(keychain_name)

allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G1', 'G2', 'G3', 'G4', 'G5'])
allow(FastlaneCore::CertChecker).to receive(:installed_wwdr_certificates).and_return(['G2', 'G3', 'G4', 'G5'])
expect(FastlaneCore::CertChecker.install_missing_wwdr_certificates).to be(1)
end
end
Expand Down

0 comments on commit 8aed4cc

Please sign in to comment.