Skip to content

Commit 27a3fbf

Browse files
committed
use new EncryptorError instead of CipherError
1 parent 8edbb87 commit 27a3fbf

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

errors/v3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
http_code: 429
1919
message: "The UAA is currently rate limited. Please try again later"
2020

21-
10001:
21+
10081:
2222
name: InternalServerError
2323
http_code: 500
2424
message: "%s"

lib/cloud_controller/validate_database_keys.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def validate_encryption_key_values_unchanged!(config)
5656
iterations: sentinel_model.encryption_iterations
5757
)
5858
# A failed decryption occasionally results in a CipherError: bad decrypt instead of a garbled string
59-
rescue OpenSSL::Cipher::CipherError
59+
# This is now caught inside Encryptor and re-raised as EncryptorError
60+
rescue VCAP::CloudController::Encryptor::EncryptorError
6061
labels_with_changed_keys << label_string
6162
next
6263
end

spec/support/shared_examples/models/encrypted_attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def last_row
5353

5454
begin
5555
decrypted_value = Encryptor.decrypt(saved_attribute, model.send(attr_salt), label: model.encryption_key_label, iterations: model.encryption_iterations)
56-
rescue OpenSSL::Cipher::CipherError
56+
rescue VCAP::CloudController::Encryptor::EncryptorError
5757
errored = true
5858
end
5959

spec/unit/lib/cloud_controller/encryptor_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ module VCAP::CloudController
155155

156156
result = begin
157157
Encryptor.decrypt(encrypted_string, salt, iterations: encryption_iterations)
158-
rescue OpenSSL::Cipher::CipherError => e
158+
rescue VCAP::CloudController::Encryptor::EncryptorError => e
159159
e.message
160160
end
161161

@@ -169,7 +169,7 @@ module VCAP::CloudController
169169

170170
result = begin
171171
Encryptor.decrypt(encrypted_string, salt, label: 'death', iterations: encryption_iterations)
172-
rescue OpenSSL::Cipher::CipherError => e
172+
rescue VCAP::CloudController::Encryptor::EncryptorError => e
173173
e.message
174174
end
175175

0 commit comments

Comments
 (0)