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

ensure we delete individual submissions on disk #923

Merged
merged 6 commits into from
Mar 17, 2020
Merged

Conversation

redshiftzero
Copy link
Contributor

@redshiftzero redshiftzero commented Mar 12, 2020

Description

Fixes #892.

Test Plan

Given the importance of the deletion functionality, I recommend testing the following cases:

Precondition for each case: Via the source interface, create a source with at least one file. Log into the client and download the file.

  1. Source is deleted by the local user. The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.
  2. Source is deleted by another user (you can simulate this by deleting an entire source in the JI). The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.
  3. An individual submission is deleted by another user (you can do this by deleting an individual submission in the JI). The file and its enclosing folder should be deleted: ~/.securedrop_client/data/intrusive_smattering/1-intrusive_smattering-doc.

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, packaging logic (e.g., the AppArmor profile) may need to be updated. Please check as applicable:

  • I have submitted a separate PR to the packaging repo
  • No update to the packaging logic (e.g., AppArmor profile) is required for these changes - I ran through the test plan above using the existing AppArmor profile
  • I don't know and would appreciate guidance

Copy link
Contributor

@rmol rmol left a comment

Choose a reason for hiding this comment

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

  1. Source is deleted by the local user. The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.
  2. Source is deleted by another user (you can simulate this by deleting an entire source in the JI). The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.
  3. An individual submission is deleted by another user (you can do this by deleting an individual submission in the JI). The file and its enclosing folder should be deleted: ~/.securedrop_client/data/intrusive_smattering/1-intrusive_smattering-doc.

In the third test, the file and its directory were indeed deleted, but the file was still shown in the conversation view, with export and print buttons. Selecting another source and returning cleared the conversation view, but the filename was still visible in the source's snippet.

securedrop_client/storage.py Outdated Show resolved Hide resolved
tests/test_storage.py Outdated Show resolved Hide resolved
@redshiftzero redshiftzero force-pushed the 892-on-disk-deletion branch from 20da467 to 12b0b6c Compare March 13, 2020 00:00
@redshiftzero
Copy link
Contributor Author

thanks for the comments! addressed and repushed. With respect to the two other findings, I believe they are covered by two other bugs: the conversation refresh not updating as part of #891, and the snippets not updating in #922

rmol
rmol previously approved these changes Mar 13, 2020
@rmol
Copy link
Contributor

rmol commented Mar 13, 2020

Changes look good, can be merged after a rebase.

@redshiftzero
Copy link
Contributor Author

thanks for review! rebased

@redshiftzero redshiftzero force-pushed the 892-on-disk-deletion branch from 2b7fdad to a6bed3a Compare March 13, 2020 23:28
@rmol
Copy link
Contributor

rmol commented Mar 13, 2020

Oh, bad news. I think some of the changes on master have broken things.

  1. Source is deleted by the local user. The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.

This worked, but the new "pending deletion" state wrote "Deleting..." over the empty conversation view text. It eventually corrected of course, but it was ugly in the meantime.

  1. Source is deleted by another user (you can simulate this by deleting an entire source in the JI). The entire source directory ~/.securedrop_client/data/intrusive_smattering should be deleted.

This crashed the client with:

Traceback (most recent call last):
  File "/home/user/src/fpf/securedrop-client/securedrop_client/logic.py", line 459, in on_sync_success
    self.update_sources()
  File "/home/user/src/fpf/securedrop-client/securedrop_client/logic.py", line 498, in update_sources
    self.gui.show_sources(sources)
  File "/home/user/src/fpf/securedrop-client/securedrop_client/gui/main.py", line 150, in show_sources
    self.main_view.show_sources(sources)
  File "/home/user/src/fpf/securedrop-client/securedrop_client/gui/widgets.py", line 695, in show_sources
    deleted_sources = self.source_list.update(sources)
  File "/home/user/src/fpf/securedrop-client/securedrop_client/gui/widgets.py", line 926, in update
    del self.source_widgets[list_widget.source_uuid]
KeyError: 'da31ba2b-020e-4339-82d3-7ffa7858e47a'
  1. An individual submission is deleted by another user (you can do this by deleting an individual submission in the JI). The file and its enclosing folder should be deleted: ~/.securedrop_client/data/intrusive_smattering/1-intrusive_smattering-doc.

This went fine, except for the previously noted bugs (#891, #922).

@redshiftzero
Copy link
Contributor Author

Ahh ok, thanks for flagging. OK I'll need to take another look at this on Monday to see what happened and fix.

@redshiftzero
Copy link
Contributor Author

the new "pending deletion" state wrote "Deleting..." over the empty conversation view text

I believe this one is #929 (recent bug on master)

Otherwise for the traceback you found, I was not able to reproduce, however I added a guard to ensure that we gracefully handle if the uuid of the source widget is missing from the source_widgets dict (what's happening in your traceback afaict).

Rebased/retested/pushed on latest master (8ab6101)

@redshiftzero redshiftzero force-pushed the 892-on-disk-deletion branch from 422d6f2 to a610a3e Compare March 17, 2020 19:15
@redshiftzero
Copy link
Contributor Author

Rebased/retested on latest master (a4a69af)

Copy link
Contributor

@rmol rmol left a comment

Choose a reason for hiding this comment

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

👍

@rmol rmol merged commit 607426e into master Mar 17, 2020
@rmol rmol deleted the 892-on-disk-deletion branch March 17, 2020 19:29
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.

Submission not deleted on disk if deleted via Journalist Interface
3 participants