This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
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.
Closes #26
Closes freedomofpress/securedrop-workstation#307
This removes the hardcoded device name from the sd export code and sets it dynamically as an attribute on the
SDExport
object. To do this I'm usinglsblk
to filter out disks, and then inspecting/sys/class/block/<drive>/removable
to see if it's removable or not.This does mean that we need to ensure we run the code to pick out the drive of interest at the beginning of all USB-related export actions - I'm doing this by running the
check_usb_connected
method at the beginning of each USB-related export action.Testing
Preconditions
sd-export-usb
: check out this branch. I do this by adding a NetVM (this is for dev purposes), git cloning this repo (after installing git), checking out this branch, and then overwriting what’s installed via the package in/opt/venvs/securedrop-export/lib/python3.5/site-packages/securedrop_export
(if stretch). You can also edit the template but that's way more annoying.Test cases
Here are the tests I performed and I did not restart the VM in between these steps because I'd blow away all my local changes.
To test each step you can look at the
securedrop-client
'sExportDialog
, or just observe the logs in~/.securedrop_export/logs/export.log
insd-export-usb
.no USB drives
single USB drive
qvm-usb attach sd-export-usb <drive>
# or use the devices widget, it should not mattermultiple USB drives
ERROR_GENERIC