Skip to content

Commit

Permalink
deletion cleanup: srm -> secure_delete, new session_nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Aug 29, 2019
1 parent 3a8c83c commit 08cfcd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
Ref: https://github.com/freedomofpress/securedrop/issues/1189
Revision ID: 3da3fcab826a
Revises: a9fe328b053a
Revises: 60f41bb14d98
Create Date: 2018-11-25 19:40:25.873292
"""
import os
from alembic import op
import sqlalchemy as sa
from journalist_app import create_app
from rm import srm
from rm import secure_delete
from store import NoFileFoundException, TooManyFilesException
from worker import rq_worker_queue
from worker import create_queue

# raise the errors if we're not in production
raise_errors = os.environ.get("SECUREDROP_ENV", "prod") != "prod"
Expand All @@ -27,7 +27,7 @@

# revision identifiers, used by Alembic.
revision = '3da3fcab826a'
down_revision = 'a9fe328b053a'
down_revision = '60f41bb14d98'
branch_labels = None
depends_on = None

Expand Down Expand Up @@ -64,7 +64,7 @@ def upgrade():
)

file_path = app.storage.path_without_filesystem_id(submission.filename)
rq_worker_queue.enqueue(srm, file_path)
create_queue().enqueue(secure_delete, file_path)
except NoFileFoundException:
# The file must have been deleted by the admin, remove the row
conn.execute(
Expand All @@ -86,7 +86,7 @@ def upgrade():
)

file_path = app.storage.path_without_filesystem_id(reply.filename)
rq_worker_queue.enqueue(srm, file_path)
create_queue().enqueue(secure_delete, file_path)
except NoFileFoundException:
# The file must have been deleted by the admin, remove the row
conn.execute(
Expand Down
5 changes: 3 additions & 2 deletions securedrop/tests/migrations/migration_3da3fcab826a.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ def create_journalist(self):
params = {
'uuid': str(uuid4()),
'username': random_chars(50),
'session_nonce': 0
}
sql = '''INSERT INTO journalists (uuid, username)
VALUES (:uuid, :username)
sql = '''INSERT INTO journalists (uuid, username, session_nonce)
VALUES (:uuid, :username, :session_nonce)
'''
self.journalist_id = db.engine.execute(text(sql), **params).lastrowid

Expand Down

0 comments on commit 08cfcd8

Please sign in to comment.