-
Notifications
You must be signed in to change notification settings - Fork 691
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
Encrypted at rest tagging #1611
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… between sources/submissions and labels
…using tags Tests verify that an admin is able to add and remove tag categories from the SecureDrop server, that a journalist is able to add and remove labels from a particular source or submission, and that they are able to filter sources by particular labels. This also modifies the templates to add ids to some elements for ease of testing.
* DRY up utility functions * Use SQLAlchemy ORM more effectively (i.e. relationships)
…for rebase As part of a rebase of @redshiftzero's `tagging` branch onto `develop`, I had to skip an unmergeable patch, 3f3bbb8 because it modified a no longer existing file. The commit in question defined some CSS styles for the tags in Jen's implementation of tagging support. Since we switched to SASS, I also couldn't just run `git show 3f3bbb8 | patch securedrop/sass/journalist.sass`--there was some refactoring involved anyway, which I only discovered once digging into the SASS. I ended up manually converting the CSS to SASS and placing it in the appropriate files. This committ is the result of that work.
Closing for now because I know this won't get considered for merge for a really long time and will be out of date by then. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is far from ready. Creating this PR to get early feedback on my implementation of database column encryption.
Database column encryption works as follows. Upon creation of the first admin, a single, shared database key is generated server-side. This key is encrypted to a key derived from the admin's password and a salt and stored in a new column in their
Journalist
record. Upon login to the JI, the admin's password and salt are used to derive the key that decrypts this shared database key. The database key plaintext is then stored in the client-side session. Each time a request is made that involves label text, the database key, sent to the server via the signed client-side session, is used to decrypt and encrypt label text. I created a transformer and comparator to allow searching the encrypted records, and ensure uniqueness of label text. When a new user is created, the database key is also taken from the client-side session of the admin creating the new user, and encrypted to the "personal_key
" derived from their password and a new salt, the encrypted database key and salt being stored as new columns in this new usersJournalist
record.The concepts here are somewhat similar to what we do with source codenames. Since we can avoid the nightmare that is GPG and use much faster AES-CTR, the implementation is fairly simple, and in manual testing I don't experience a slow down (more on this in a bullet point below). In the future, I'd like to expand and improve on the ideas here and apply them to additional database columns. If we were to add authentication and create a server-side client, this could be one way de-privilege the app server (although I have some other ideas to this regard that might be better).
There's a lot left to implement and investigate, including:
manage
module snuck into one of Jen's commits, and I'll need to revert that to scope the PR appropriately.flash
(re DRY out flashed templates #1602), and see if we're unnecessarily creating too many categories.manage
module that handles the case where an admin is created who is not the first admin. This will require another user (not even admin) to enter their credentials in order to decrypt the database key so it can be encrypted to the new admin. This we can assume is a pretty rare scenario, so hopefully it won't be too burdensome when it does have to happen.One more thing I'll touch on as a later idea is that if #204 is implemented we could store the database side in sources' client-side sessions. The reason for this is that it would allow us to encrypt sensitive columns such as submission times and could pose an alternative or addition to #822.
Closes #1170. Closes #1422 (supersedes). Closes #1562.