Commit graph

1014 commits

Author SHA1 Message Date
deeplow
0aeef1c2d0
CHANGELOG: Fix issue #513 description 2023-10-19 20:43:38 +01:00
Alex Pyrgiotis
bd01facaf1
Bump README refs to v0.5.0 2023-10-19 21:58:17 +03:00
deeplow
8d167382a3
v0.5.0 changelog: add missing fixes 2023-10-17 20:52:17 +01:00
Alex Pyrgiotis
44a73007a8
Drop last mention to Fedora 36 2023-10-17 15:22:20 +03:00
Erik Moeller
822f5bcd4c
Minor tweaks to Qubes build docs
- `keyring` command will only work if `python3-keyring` is installed
- fix `cp` command (`qubes` directory not included in prior command)
2023-10-17 11:45:02 +03:00
Alex Pyrgiotis
a2dafdb505
Add ubuntu 23.10 (mantic) support
Fixes #601
2023-10-17 11:31:30 +03:00
deeplow
2f98135f5a
Skip scenario 9 on linux (Qubes-specific) 2023-10-16 08:43:26 +01:00
Alex Pyrgiotis
f02597aa4f
Make isort use .gitignore properly
By using `--skip / --extend-skip .gitignore`, we actually never read the
.gitignore file. We have to use `--skip-gitignore` instead.

This requires Git in the development environment, so we need to install
Git in our CI runners as well.
2023-10-13 22:45:37 +03:00
Alex Pyrgiotis
ba5adb33c0
Fix a bug in "Change Selection"
Fix a bug in the "Change Selection" action, whereby changing your
selection and picking files from another directory results in:

    "Dangerzone does not support adding documents from multiple
    locations. The newly added documents were ignored."

To fix this, change the output directory when we change selection as
well.
2023-10-13 22:45:11 +03:00
Alex Pyrgiotis
edfba0c783
Qubes: Fix progress in first stage of Qubes conversion 2023-10-13 22:44:37 +03:00
deeplow
186ddd6b1e
Allow user to override update checking on Linux
The original intention of leaving the update checkbox in the hamburger
menu was to let non-supported Linux distros (e.g. compiled from source)
to check for updates. However, on Linux it ended up being disabled
forcefully by default on startup.

This takes into account an overriden update checkbox.

Fixes #596
2023-10-13 17:01:53 +01:00
deeplow
18898992f1
BUILD.md: Add instructions to clone the git repo 2023-10-13 07:47:27 +01:00
Alex Pyrgiotis
b11920a3af
Add a note in build instructions for dev environments 2023-10-11 15:54:10 +01:00
Alex Pyrgiotis
2256f9fb4e
ci: Test building Qubes package in CircleCI 2023-10-11 15:54:09 +01:00
Alex Pyrgiotis
c4c46a0a8d
Small fixes for Qubes PRM
This commit fixes 3 small issues with the way we produce our Qubes RPM:

1. The `.exists()` method follows symlinks by default, whereas we want
   to check if a symlink exists. This functionality has been added in
   Python
   3.12.

   Instead of checking if a symlink exists and then removing it, simply
   remove it and don't throw an error if it doesn't exist in the first
   place.

2. The `dz.Convert*` policies were not installed with the executable bit
   set, therefore the qube could not start.

3. The `dz.ConvertDev` policy in particular had an ambiguous shebang,
   thus we change it to explicitly call Python3
2023-10-11 15:54:06 +01:00
deeplow
39fe539b2e
Mirror RELEASE.md text in qa.py
qa.py should be in sync with RELEASE.md, or else it fails with

    $ ./dev_scripts/qa.py --check-refs

This was accidentally introduced in
https://github.com/freedomofpress/dangerzone/pull/583/files
2023-10-11 15:31:45 +01:00
Alex Pyrgiotis
8dc8372998
Add extra Qubes QA scenarios
Add some QA scenarios that target QA testing on Qubes.
2023-10-11 10:33:31 +01:00
Alex Pyrgiotis
3daf0e2cb7
Do not show file previews in case of exceptions
If a Qubes conversion encounters an exception that is not a subclass of
ConversionException, it will still show a preview of a file that does
not exist.

Send an error progress report in that case, so that the GUI code can
detect that an error occurred and not open a file preview

Fixes #581
2023-10-05 11:11:42 +03:00
Alex Pyrgiotis
bdf3f8babc
qubes: Clean up temporary files
Create a temporary dir before the conversion begins, and store every
file necessary for the conversion there. We are mostly concerned about
the second stage of the conversion, which runs in the host. The first
stage runs in a disposable qube and cleanup is implicit.

Fixes #575
Fixes #436
2023-10-04 14:05:23 +03:00
Alex Pyrgiotis
f37d89f042
conversion: Allow using a temp dir other than /tmp
Extend the PixelsToPDF converter by adding an additional `tempdir`
argument. This argument can be used to make the conversion use a
different temporary directory other than `/tmp`.

For containers, this extra arguments makes no difference, as it won't be
used. For Qubes, this argument will allow storing files in a temporary
dir that will be cleaned up once the conversion completes. Previously,
these files would linger in the user's `/tmp`.

Refs #575
2023-10-04 14:00:53 +03:00
deeplow
c4fdebc80d
Update Poetry lock file
Run `poetry lock` and update the existing dependencies again thanks
to a urrlib vulnerability that was announced a bit after our last
dependency bump.
2023-10-03 09:56:30 +01:00
Alex Pyrgiotis
2a0ef78d91
Update our changelog for 0.5.0 2023-10-03 11:32:38 +03:00
Alex Pyrgiotis
1961899bed
Bump version to 0.5.0 2023-10-03 11:32:38 +03:00
Alex Pyrgiotis
89a36efe89
tests: Fix typo 2023-10-03 11:32:37 +03:00
deeplow
049fa7d484
Update notarization process (altool deprecated)
Following de deprecation notice of the Apple notarization tool 'altool',
we're updating the instructions to reflect the change to the new tool
'notarytool'.

The migration process essentially required updating the commands and
migrating credentials. It is documented in [1].

Fixes #506

[1]: https://developer.apple.com/documentation/technotes/tn3147-migrating-to-the-latest-notarization-tool
2023-10-02 16:03:32 +01:00
Alex Pyrgiotis
a8ee8cdd4a
Update Poetry lock file
Run `poetry lock` and update the existing dependencies.
2023-10-02 17:58:52 +03:00
Alex Pyrgiotis
4f66353639
Add dark mode logic in our dialogs
Make our dialogs set the OSColorMode CSS property, so that we can
properly style them.

Refs #528
2023-10-02 16:34:56 +03:00
Alex Pyrgiotis
6232062146
Add missing newline char 2023-10-02 15:41:29 +03:00
Alex Pyrgiotis
b7b76174ab
qubes: Log captured output for the second stage
Log the captured command output during the second stage, only in dev
environments. This follows what we have already done for the first
stage.
2023-10-02 15:41:29 +03:00
Alex Pyrgiotis
16603875d6
qubes: Display all errors in second stage
If a command encounters an error or times out during the second stage of
the conversion in Qubes, handle it the same way as we would have handled
it in the first stage:

1. Get its error message.
2. Throw an UnexpectedConversionError exception, with the original
   message.

Note that, because the second stage takes place locally, users will see
the original content of the error.

Refs #567
Closes #430
2023-10-02 15:41:17 +03:00
Alex Pyrgiotis
2016965c84
Revert "Enable HWP conversion on MacOS M1"
This reverts commit 214ce9720d. The
rationale is that we want to wait until the LibreOffice package that
allows HWP conversion in Alpine Linux lands in `alpine:latest`.

For more info, read
https://github.com/freedomofpress/dangerzone/issues/498#issuecomment-1739894100
2023-10-02 14:22:47 +03:00
Alex Pyrgiotis
6973845ec9
Revert "Switch to the edge repo of Alpine Linux"
This reverts commit acd615e0e1. The
rationale is that we want to wait until the LibreOffice package that
allows HWP conversion in Alpine Linux lands in `alpine:latest`.

For more info, read
https://github.com/freedomofpress/dangerzone/issues/498#issuecomment-1739894100
2023-10-02 14:22:46 +03:00
deeplow
7daeccdfea
Prevent PDF from overwriting num_pages in Qubes
This should only affect the alpha version of Qubes OS (in containers
it only allows the attacker to control the timeout). In short, an
attacker could have PDF metadata that would show before "Pages:" in
the `pdfinfo` command output and this would essentially override the
number of pages measured in the server. This could enable the attacker
to shorten the number of pages of a document for example.

Fixes #565
2023-10-02 12:18:12 +01:00
deeplow
dabdf6c286
FIXUP: rename to QubesQrexecFailed instead 2023-10-02 12:06:18 +01:00
deeplow
eb488b16c5
FIXUP: rename QubesNotEnoughRAMError to QubesConversionStartFailed 2023-10-02 11:51:55 +01:00
deeplow
9cfac7ac2a
Generalize "out of RAM" error to reflect other issues
When qrexec-client-vm fails, it could be a symptom of various issues:
  - the system being out of RAM
  - dz-dvm not existing

The exit code is the same in all cases (126), which makes it
particularly tricky to solve in the client application. For this reason
the approach is now to tell the user to see the qubes error notification
on the top right of their screen.
2023-10-02 11:06:17 +01:00
Alex Pyrgiotis
ccf4132ea0
conversion: Add sanity check for page count
Add a sanity check at the end of the conversion from doc to pixels, to
ensure that the resulting document will have the same number of pages as
the original one.

Refs #560
2023-09-28 22:50:54 +03:00
Alex Pyrgiotis
b4e5cf5be7
qubes: Stream page data in real time
Stream page data back to the caller, immediately after we read them from
pdftoppm. This way, we have more accurate progress reports and timeouts.

Fixes #557
2023-09-28 22:50:54 +03:00
Alex Pyrgiotis
4bb959f220
conversion: Add anchor points for streaming page data/metadata
Introduce 4 new methods that can be overloaded by the Qubes isolation
provider to stream page data/metadata back to the caller. For the time
being, these methods do what they did before, i.e., write this info in
files within the pixels directory.
2023-09-28 22:50:53 +03:00
Alex Pyrgiotis
6012cd1491
Improve EOF detection when reading command output
Do not read a line from the command output and then check if
we are at EOF, because it's possible that the writer immediately exited
after writing the last line of output. Instead, switch the order of
actions.

This is a very serious bug that can lead to Dangerzone excluding the
last page of the document. It should have bit us right from the start
(see aeeed411a0), but it seems that the
small period of time it takes the kernel to close the file descriptors
was hiding this bug.

Fixes #560
2023-09-28 22:50:53 +03:00
Garrett Robinson
79c1d6db0f
Use extend_skip to avoid overriding isort's skip default
This preserves isort's default behavior of ignoring virtualenvs with
common names like `venv` or `.venv`, which is helpful when running
`isort` in a local development environment that uses such a
virtualenv.
2023-09-28 17:21:00 +03:00
Garrett Robinson
eab768f950
Style safe_extension_filename consistently in Dark Mode
To be consistent with Light Mode, the background of the
safe_extension_filename QLabel should match the adjacent QTextField,
but the text should be "grayed out"/disabled to indicate that it's not
supposed to be editable.
2023-09-28 17:20:54 +03:00
Garrett Robinson
40b6240097
Only set certain colors in light mode 2023-09-28 17:20:50 +03:00
Garrett Robinson
46f978e6f0
Detect OS color mode and set as property for stylesheets
Sets the detected OS color mode (dark/light) as a property on the
QApplication so it can be referenced in stylesheets to select style
rules suited to the OS color mode.
2023-09-28 17:20:34 +03:00
deeplow
23bee23d81
Disable isolation_provider tests on dummy conversion
Windows and macOS in CI (which don't support nested virtualization)
and thus Docker aren't really candidates for isolation_provider tests.
2023-09-28 11:08:53 +01:00
deeplow
0a6b33ebed
Qubes: detect qube failing to start (missing RAM)
In Qubes OS it's often the case that the user doesn't have enough
RAM to start the conversion. In this case it raises BrokenPipeException
and exits with code 126.

It didn't seem possible to distinguish this kind of failure to one
where the user has misconfigured qrexec policies.

NOTE: this approach is not ideal UX-wise. After the first doc failing
the next one will also try and fail. Upon first failure we should
inform the user that they need to close some programs or qubes.
2023-09-28 11:08:50 +01:00
deeplow
63f03d5bcd
Add limit and test to max width and height of docs 2023-09-28 11:08:47 +01:00
deeplow
6f26fc6303
Qubes: add test if MAX_PAGES is enforced in client
Because the server also checks the MAX_PAGES limit, the test in base
would hide the fact that the client is not enforcing the limit. This
ensures that's not the case.

When the pages in containers are streamed (#443), then this test should
be in base.py.
2023-09-28 11:06:36 +01:00
deeplow
54b8ffbf96
Add page limit of 10000
Theoretically the max pages would be 65536 (2byte unsigned int.
However this limit is much higher than practical documents have
and larger ones can lead to unforseen problems, for example RAM
limitations.

We thus opted to use a lower limit of 10K. The limit must be
detected client-side, given that the server is distrusted. However
we also check it in the server, just as a fail-early mechanism.
2023-09-28 11:01:14 +01:00
deeplow
afba362d22
Tests: split isolation provider tests per provider
Isolation provider tests done in tests/test_base.py and had
pytest.mark.parameterize() for each isolation provider. This logic
would not work well when we had test that diverge. We could have marked
each one as compatible with one provider or another, but in the end it
turned out to be better to have the common ones in a base class and
the divergent ones in each.

NOTE: this has a strange side-effect: inherited test classes need to
have imports for all of the fixtures even if they are not explictly used
2023-09-28 09:53:29 +01:00