Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Remove obsolete and expired WWDR G1 certificate #21271

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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')
Copy link

@thehale thehale May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this deletion (and the others like it later in the PR) assert that the G1 is absent from the set of installed certs? OR does it merely stop caring about the G1?

I'd imagine we want the first.

NOTE: I have little experience with Ruby development, so my concern here may be unfounded.

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