Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ GEM
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (4.1.0)
newrelic_rpm (5.2.0.345)
newrelic_rpm (5.4.0.347)
nio4r (2.3.1)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
Expand Down
5 changes: 5 additions & 0 deletions spec/services/encryption/password_verifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
describe '.digest' do
it 'creates a digest from the password' do
salt = '1' * 64 # 32 hex encoded bytes is 64 characters
# The newrelic_rpm gem added a call to `SecureRandom.hex(8)` in
# abstract_segment.rb on 6/13/18. Our New Relic tracers in
# config/initializers/new_relic_tracers.rb trigger this call, which
# is why we stub with a default value first.
allow(SecureRandom).to receive(:hex) { salt }
allow(SecureRandom).to receive(:hex).once.with(32).and_return(salt)

digest = described_class.digest('saltypickles')
Expand Down
9 changes: 7 additions & 2 deletions spec/services/encryption/user_access_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

before do
allow(FeatureManagement).to receive(:use_kms?).and_return(true)
# The newrelic_rpm gem added a call to `SecureRandom.hex(8)` in
# abstract_segment.rb on 6/13/18. Our New Relic tracers in
# config/initializers/new_relic_tracers.rb trigger this call, which
# is why we stub with a default value first.
allow(SecureRandom).to receive(:random_bytes) { random_r }
allow(SecureRandom).to receive(:random_bytes).with(32).and_return(random_r)
stub_aws_kms_client(random_r, encrypted_random_r)
end
Expand Down Expand Up @@ -78,7 +83,7 @@
it 'assigns random_r and calculates the cek, encryption_key, and encrypted_password' do
subject.build

expect(SecureRandom).to have_received(:random_bytes).once
expect(SecureRandom).to have_received(:random_bytes).with(32).once
expect(subject.random_r).to eq(random_r)
expect(subject.encryption_key).to eq(encryption_key)
expect(subject.cek).to eq(cek)
Expand All @@ -90,7 +95,7 @@
it 'derives random_r from the encryption key and sets the cek and encrypted password' do
subject.unlock(encryption_key)

expect(SecureRandom).to_not have_received(:random_bytes)
expect(SecureRandom).to_not have_received(:random_bytes).with(32)
expect(subject.random_r).to eq(random_r)
expect(subject.encryption_key).to eq(encryption_key)
expect(subject.cek).to eq(cek)
Expand Down