Encrypt your columns like so:
class Deployment < ActiveRecord::Base
extend EncryptedAttributes
serialize :secret_config, Hash
encrypt :secret_config
end
Here is an example config/encryption_keys.yml file:
common: &shared
# Digest::SHA2.hexdigest('Bond, James Bond')
key: 989e6405af5c637850f1e97861eb42d326f4b416b91ad37b2e573ed045cc1cf5
# SecureRandom.urlsafe_base64(4)
iv: C4vaiQ
development:
<<: *shared
test:
<<: *shared
production: # DO NOT CHECK THIS IN TO VCS! uplaod it to the production server directly
key:
iv:
Add something like this to config/initializers/encrypted_attributes.yml:
path = Rails.root.join( Rails.root, 'config', 'encryption_keys.yml' )
ae_config = File.exist?(path) ? YAML.load( File.open(path) )[ Rails.env ] : {}
ae_config['key'] ||= ENV['ENCRYPTED_ATTRIBUTES_KEY']
ae_config['iv'] ||= ENV['ENCRYPTED_ATTRIBUTES_IV']
EncryptedAttributes.setup( ae_config.extract! 'key', 'iv' )
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request