Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 0.7.1 release #42

Merged
merged 4 commits into from
Nov 21, 2018
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Vault Rails Changelog

## Unreleased
## v0.7.1 (November 21, 2018)

NEW FEATURES
- Support for batch encryption/decryption via `Vault::Rails.batch_encrypt`
and `Vault::Rails.batch_decrypt` methods.
- Introduce deprecation warnings for the breaking changes between 0.6 and
0.7. This includes adding back `Vault::AttributeProxy` as an empty
module that generates a deprecation warning.

BUG FIXES
- Actually persist encrypted attributes when using
`vault_persist_before_save!` in rails 5.2
- Support lazy loading of `nil` values.

## v0.7.0 (October 24, 2018)

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,18 @@ In order to use this method for an attribute you need to add the following row i
vault_attribute_proxy :attribute, :attribute_ciphertext, encrypted_attribute_only: true
```

Upgrading to 0.7 from 0.6
-------------------------

Version 0.6 targets rails 4.x and 0.7 targets rails 5.x. There are breaking changes between the two versions too, so upgrading isn't as smooth as it could be.

1. You no longer need to `include Vault::AttributeProxy` to get `vault_attribute_proxy` as it is part of `Vault::EncryptedModel` now. In 0.7.0 the `Vault::AttributeProxy` module isn't part of the gem, but from 0.7.1+ it exists just to emit a deprecation warning reminding you to stop including it.

**If you do nothing** your app will still work properly in 0.7.1+, but you'll get annoying messages.

2. The position of the `type` parameter has changed from `vault_attribute_proxy` in 0.6 to `vault_attribute` in 0.7. In 0.7 if you have a `type` option on `vault_attribute_proxy` it will emit a deprecation warning reminding you to move the definition onto `vault_attribute`.

**If you do nothing** your app will likely break because `fc-vault-rails` will assume your `vault_attribute` is just a string and if you had `type` on `vault_attribute_proxy` it's likely not.

Development
-----------
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_4.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
fc-vault-rails (0.7.0)
fc-vault-rails (0.7.1)
activerecord (>= 4.2.8, < 6.0)
vault (~> 0.7)

Expand Down Expand Up @@ -148,4 +148,4 @@ DEPENDENCIES
wwtd

BUNDLED WITH
1.16.2
1.16.6
2 changes: 1 addition & 1 deletion gemfiles/rails_5.0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
fc-vault-rails (0.7.0)
fc-vault-rails (0.7.1)
activerecord (>= 4.2.8, < 6.0)
vault (~> 0.7)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_5.1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
fc-vault-rails (0.7.0)
fc-vault-rails (0.7.1)
activerecord (>= 4.2.8, < 6.0)
vault (~> 0.7)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_5.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
fc-vault-rails (0.7.0)
fc-vault-rails (0.7.1)
activerecord (>= 4.2.8, < 6.0)
vault (~> 0.7)

Expand Down
12 changes: 12 additions & 0 deletions lib/vault/attribute_proxy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "active_support/concern"
require "active_support/deprecation"

module Vault
module AttributeProxy
extend ActiveSupport::Concern

included do
ActiveSupport::Deprecation.warn('Vault::AttributeProxy is no longer required, `vault_attribute_proxy` comes via `Vault::EncryptedModel` so you can remove `include Vault::AttributeProxy` from your model.')
end
end
end
3 changes: 3 additions & 0 deletions lib/vault/encrypted_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def vault_persist_before_save!
# Whether to read and write to both encrypted and non-encrypted attributes.
# Useful for when we stop using the non-encrypted one.
def vault_attribute_proxy(non_encrypted_attribute, encrypted_attribute, options={})
if options[:type].present?
ActiveSupport::Deprecation.warn('The `type` option on `vault_attribute_proxy` is now ignored. To specify type information you should move the `type` option onto the `vault_attribute` definition.')
end
# Only return the encrypted attribute if it's available and encrypted_attribute_only is true.
define_method(non_encrypted_attribute) do
return send(encrypted_attribute) if options[:encrypted_attribute_only]
Expand Down
1 change: 1 addition & 0 deletions lib/vault/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'json'

require_relative 'encrypted_model'
require_relative 'attribute_proxy'
require_relative 'rails/configurable'
require_relative 'rails/errors'
require_relative 'rails/serializers/json_serializer'
Expand Down
2 changes: 1 addition & 1 deletion lib/vault/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Vault
module Rails
VERSION = "0.7.0"
VERSION = "0.7.1"
end
end