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

Add platform independent file opening #115

Closed
redshiftzero opened this issue Nov 6, 2018 · 3 comments
Closed

Add platform independent file opening #115

redshiftzero opened this issue Nov 6, 2018 · 3 comments
Labels
dev env help wanted Extra attention is needed

Comments

@redshiftzero
Copy link
Contributor

redshiftzero commented Nov 6, 2018

We use QProcess to open files in a disposable VM using qvm-open-in-vm, which is a Qubes-only program. We could use xdg-open to open files such that this file open process would also work in Linux, but by always using qvm-open-in-vm, we get defense in depth as we will not accidentally open a file in the sd-app AppVM if there is a misconfiguration with the mime type handlers in the sd-app VM.

The problem with this is that now on Mac or Linux, we can't open files. We can apply a patch, like:

diff --git a/securedrop_client/logic.py b/securedrop_client/logic.py
index 8b5c27c..99bbe4f 100644
@@ -462,6 +462,11 @@ class Client(QObject):
             process = QProcess(self)
             process.start(command, args)
         else:  # pragma: no cover
+            # Running on mac.
+            command = "open"
+            args = [submission_filepath]
+            process = QProcess(self)
+            process.start(command, args)
             # Non Qubes OS. Just log the event for now.
             logger.info('Opening file "{}".'.format(submission_filepath))

for testing, but this is not convenient for developers. Another approach is in the above diff, to subprocess out to a script that calls open (macOS) or xdg-open, depending on what the current platform is. This ticket is for implementing that approach (or a better idea if you have one!).

(Followup to #113)

@redshiftzero redshiftzero added help wanted Extra attention is needed dev env labels Nov 6, 2018
@redshiftzero redshiftzero added this to the 0.1.0beta milestone Nov 6, 2018
@eloquence eloquence modified the milestones: 0.2.0beta, Post-Beta Dec 13, 2019
@eloquence
Copy link
Member

This is very nice to have for development but not absolutely critical for beta since we must test everything in Qubes anyway, so added to Post-Beta milestone for now.

@eloquence
Copy link
Member

eloquence commented Aug 22, 2022

From 2022-08-22 review with @nathandyer @cfm @gonzalo-bulnes @eloquence:
In practice, since opening this issue, we've been doing all our testing of opening files in disposable VMs in Qubes, so this has not re-emerged as an urgent need. Closing for now, we can revisit if it turns out to be useful e.g. for CI or other automation.

@gonzalo-bulnes
Copy link
Contributor

Loosely related to #1541, which should make swapping QVM for something else easier.

legoktm pushed a commit that referenced this issue Dec 11, 2023
Ensure correct OS version builds requirements file
legoktm pushed a commit that referenced this issue Dec 11, 2023
Replace werkzeug dependency with basic string checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev env help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants