Skip to content

Improve email encryption error checking#759

Merged
pkarman merged 2 commits intomasterfrom
pek-fix-encrypted-email
Nov 22, 2016
Merged

Improve email encryption error checking#759
pkarman merged 2 commits intomasterfrom
pek-fix-encrypted-email

Conversation

@pkarman
Copy link
Contributor

@pkarman pkarman commented Nov 22, 2016

Why: Misconfiguration on deploy can erase existing email addresses forever.

How: Take a more conservative approach by renaming the plain text column for now.

db/schema.rb Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be problematic to create new accounts while this schema is in force, so we should do a subsequent drop of this column as soon as possible after verifying that the migration was successful (via manual testing of login, etc).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make it nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call. done.

@pkarman pkarman mentioned this pull request Nov 22, 2016
@pkarman pkarman force-pushed the pek-fix-encrypted-email branch from 6a1bd01 to e7243be Compare November 22, 2016 16:24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to quote/escape this?

escaped = ActiveRecord::Base.connection.quote(ee.decrypted)
execute "UPDATE users SET email=#{escaped} WHERE id=#{user.id}"

@pkarman pkarman force-pushed the pek-fix-encrypted-email branch from e7243be to 8581570 Compare November 22, 2016 16:34
**Why**: Strengthen the error checking to better identify issues
deciphering broken payloads.
@pkarman pkarman force-pushed the pek-fix-encrypted-email branch from 8581570 to ab7aaca Compare November 22, 2016 16:41
**Why**: To help with migrations, rename the email column instead
of dropping. The actual drop will happen in a future PR.
@pkarman pkarman force-pushed the pek-fix-encrypted-email branch from ab7aaca to 72e80fb Compare November 22, 2016 17:07
@pkarman pkarman merged commit 2c6aa46 into master Nov 22, 2016
@pkarman pkarman deleted the pek-fix-encrypted-email branch November 22, 2016 18:19
amoose pushed a commit that referenced this pull request Dec 1, 2016
* Refactor cipher error checking

**Why**: Strengthen the error checking to better identify issues
deciphering broken payloads.

* Rename users.email instead of dropping

**Why**: To help with migrations, rename the email column instead
of dropping. The actual drop will happen in a future PR.
amoose pushed a commit that referenced this pull request Dec 1, 2016
* Refactor cipher error checking

**Why**: Strengthen the error checking to better identify issues
deciphering broken payloads.

* Rename users.email instead of dropping

**Why**: To help with migrations, rename the email column instead
of dropping. The actual drop will happen in a future PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants