Skip to content
Snippets Groups Projects
Commit de835fb9 authored by Balasankar C's avatar Balasankar C
Browse files

Merge branch 'goexperiment-fips-mode' into 'master'

Use goexperiment boringcrypto for golang 1.19 fips

See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/6813



Merged-by: default avatarBalasankar 'Balu' C <balasankar@gitlab.com>
Approved-by: default avatarBalasankar 'Balu' C <balasankar@gitlab.com>
Co-authored-by: default avatarDJ Mountney <dj@gitlab.com>
parents 4784e2dd 997ec16d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,7 +35,10 @@ build do
 
# Pages compiles with CGO_ENABLED=0 by default, so we need to activate
# FIPS mode explicitly.
env['FIPS_MODE'] = '1' if Build::Check.use_system_ssl?
if Build::Check.use_system_ssl?
env['FIPS_MODE'] = '1'
env['GOEXPERIMENT'] = 'boringcrypto' if Build::Check.boringcrypto_supported?
end
 
make 'gitlab-pages', env: env
 
Loading
Loading
Loading
Loading
@@ -21,6 +21,10 @@ module Build
false
end
 
def boringcrypto_supported?
system({ 'GOEXPERIMENT' => 'boringcrypto' }, *%w(go version))
end
def use_system_ssl?
# Once we implement the above TODO, we can get rid of this variable and
# gate on `fips?` alone.
Loading
Loading
Loading
Loading
@@ -322,4 +322,26 @@ RSpec.describe Build::Check do
end
end
end
describe 'boringcrypto_supported?' do
context 'when using a golang with boringcrypto support' do
before do
allow(described_class).to receive(:system).with(hash_including('GOEXPERIMENT'), 'go', 'version').and_return(true)
end
it 'returns true' do
expect(described_class.boringcrypto_supported?).to be_truthy
end
end
context 'when using a golang withou boringcrypto support' do
before do
allow(described_class).to receive(:system).with(hash_including('GOEXPERIMENT'), 'go', 'version').and_return(false)
end
it 'returns true' do
expect(described_class.boringcrypto_supported?).to be_falsey
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment