Module: SecureDataBag::CheckEncrypted

Includes:
Chef::EncryptedDataBagItem::CheckEncrypted
Included in:
NestedDecryptor
Defined in:
lib/secure_data_bag/check_encrypted.rb

Overview

Common code for checking if a data bag appears encrypted

Instance Method Summary collapse

Instance Method Details

#partially_encrypted?(raw_data) ⇒ Boolean

Autodetect whether the item’s raw hash appears to be encrypted

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
# File 'lib/secure_data_bag/check_encrypted.rb', line 9

def partially_encrypted?(raw_data)
  data = raw_data.reject { |k, _| k == 'id' }

  # Detect whether any of the raw hash keys, or their nested structures
  # contain encrypted values.
  data.any? do |_, v|
    looks_like_partially_encrypted?(v)
  end
end