Commit graph

1272 commits

Author SHA1 Message Date
Archit Sharma
114881c291
Added Dependabot for Github actions
Signed-off-by: Archit Sharma <74408634+iArchitSharma@users.noreply.github.com>

Fixes #782
2024-04-22 22:02:15 +03:00
Alex Pyrgiotis
7cd73cab0e
ci: Bump PySide6 version in Fedora end-user envs
Our end-user Fedora environments, that we create for testing how
Dangerzone would operate on a clean Fedora system, require PySide6 to be
installed. This package is not available from the official Fedora repos
yet.

We have a way instead to check the poetry.lock file, grab the latest
PySide6 version from there, and install it from a URL. This is no longer
necessary, now that PySide6 6.7.0 will soon be available in all stable
Fedora releases. Since the last release maintained by FPF will be
6.6.3.1, we should pin this version in our env.py script. This way, we
can bump poetry.lock independently, and let Windows/macOS users get
different versions.

Refs freedomofpress/maint-dangerzone-pyside6#5
2024-04-19 00:54:07 +03:00
Naglis Jonaitis
7c4e62954f
Update GitHub actions
The `checkout`, `setup-python`, `upload-artifact` and `download-artifact`
actions produce warnings about deprecated Node.js 16.

Update the actions to use Node.js 20.
2024-04-09 14:39:26 +03:00
Naglis Jonaitis
fc503d0a96
Fix test-large phony target name 2024-04-08 17:38:18 +03:00
Naglis Jonaitis
a4b20ae101
Avoid DUMMY_CONVERSION env var treated as bool in CI
`DUMMY_CONVERSION: True` is treated as a boolean value in YAML[1]. As a
result, during GitHub CI the environment variable setup during tests is
formatted as `DUMMY_CONVERSION=true`.

The value is used[2] in tests and passed as the `condition` to the
`pytest.mark.skipif`[3] decorator. The `skipif` `condition` can be
either a `bool` or `str`. When it is a `str` (our case, as we use
`os.environ.get()`), it is treated as a condition string[4] by pytest.

Since the condition string is `eval()`ed[5] by pytest, trying to
evaluate `true` results in:

> Failed: Error evaluating 'skipif' condition
>     true
> NameError: name 'true' is not defined

To avoid the implicit conversion to a JSON boolean, or marking the
"True" value as a string literal, use the value `1` instead.

[1]: https://yaml.org/type/bool.html
[2]: 9bb1993e77/tests/isolation_provider/base.py (L25)
[3]: https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipif-ref
[4]: https://docs.pytest.org/en/stable/historical-notes.html#string-conditions
[5]: f75dd87eb7/src/_pytest/skipping.py (L117)
2024-04-08 15:24:19 +03:00
deeplow
9bb1993e77
Create tests/test_settings.py with extra coverage
Previously settings was implicitly tested on tests/gui/test_updater.py.
However this was concerned with updater-related tests only, which
incidentally covered almost all of settings.py. However, a few tests
were missing. This commit increases the test coverage, but also tests
additional test conditions.

The goal is to help us increase the test coverage of the previous
scenario, which tested for the persistence of user data (settings). This
way we can drop the requirement to test this on linux hosts, which is
slightly harder (more cumbersome) to do.
2024-04-01 18:18:41 +03:00
deeplow
dfcb10c494
Move settings.json into constant
Move settings.json into a constant so that they can later be referred to
by the testing module.
2024-04-01 18:18:41 +03:00
deeplow
ad16a0e471
Fix Settings().set() when setting new setting
Settings().set() would fail if we were trying to set a setting that did
not exist before. The reason is because before setting it would try to
get the previous value, but though direct key access, which would lead
to an exception.
2024-04-01 18:18:41 +03:00
deeplow
5c86927269
Change "external state" QA scenario to only win/mac
The previous scenario 10 tested the handling of state upon Dangerzone
updates. This, however was particularly difficult to do on Linux due to
the need to add a repository and install, especially in our
semi-automated QA environment.

For this reason this commits removes Linux from this scenario and moves
it closer to the top of the scenarios list to reduce the change of
state "contamination". In other words, before testing the new version,
the tester now installs a previous version and then the new one, thus
guaranteeing that there is no inconsistent state due to installing an
earlier version later in QA.

Fixes #719
2024-04-01 18:18:40 +03:00
Naglis Jonaitis
b284a55dc6
Fix typos 2024-03-28 13:23:36 +02:00
Alex Pyrgiotis
29d6854eca
Minor Wix-related fixes
Fix an outdated instruction for installing WiX, and point to the correct
executable for Windows, which was rebuilt for the new WiX version.
2024-03-23 15:06:21 +02:00
Štěpán Němec
c98bd358ac
Bump PyMuPDF dependency to unbreak Dangerzone image build
The problem (MuPDF C++ bindings generation breakage) was
apparently caused by a recent libclang update on pypi, and
fixed in the 1.24.0 release[1].

Fixes #750
[1]: https://github.com/pymupdf/PyMuPDF/issues/3279
2024-03-22 17:14:42 +02:00
Alex Pyrgiotis
ab1772b9af
ci: Update WiX Toolset path
Update the WiX Toolset from 3.11 to 3.14, since the former is no longer
available in GitHub CI runners.
2024-03-13 21:04:39 +02:00
Alex Pyrgiotis
c40338a13c
Unpin PyMuPDF dependency
Unpin the PyMuPDF dependency, now that we have a way to silence its
debug logs that have been added in its new `fitz` implementation.

Refs #700
2024-03-13 21:03:15 +02:00
Alex Pyrgiotis
ce5adb33fd
Bump poetry dependencies 2024-03-13 21:03:15 +02:00
Alex Pyrgiotis
74c467eaf7
conversion: Do not let PyMuPDF print to stdout
PyMuPDF has some hardcoded log messages that print to stdout [1]. We don't
have a way to silence them, because they don't use the Python logging
infrastructure.

What we can do here is silence a particular call that's been creating
debug messages. For a long term solution, we have sent a PR to the
PyMuPDF team, and we will follow up there [2].

Fixes #700

[1]: https://github.com/freedomofpress/dangerzone/issues/700
[2]: https://github.com/pymupdf/PyMuPDF/pull/3137
2024-03-13 21:03:15 +02:00
Alex Pyrgiotis
be8e2aa36b
Allow setting the compression level of the image
There are times where we may want to build the container image for
testing, but compression takes too much time. If we don't plan to use
this image for production builds, we can specify instead a compression
level that is so low, that the image will be compressed instantly.

In this commit, we allow the user to specify the Gzip compression level,
and even set it to 0. The default will always be 9, so that we don't
make a mistake during release.
2024-03-13 21:03:13 +02:00
Alex Pyrgiotis
a31f3370d0
Capture missing logs in second-stage conversion
For a while now, we didn't get logs for the second-stage conversion
when using containers. Extend the code to log any captured output from
the second stage conversion, only if we run Dangerzone via our dev
entrypoint.

Note that the Qubes isolation provider was always logging output from
the second stage of the conversion.
2024-03-13 20:59:50 +02:00
deeplow
0449840ec3
dz.ConvertDev: do not teleport .pyc files
On Qubes the conversion in dev mode would fail when converting from a
Fedora 38 development qube via a Fedora 39 disposable qube. The reason
was that dz.ConvertDev was receiving `.pyc` files, which were compiled
for python 3.11 but running on python 3.12.

Unfortunately PyZipFile objects cannot send source python files, even
though the documentation is a little bit unclear on this [1].

Fixes #723

[1]: https://docs.python.org/3/library/zipfile.html#pyzipfile-objects
2024-03-13 07:13:39 +00:00
deeplow
297feab63d
Ctx mgr to ensure destuction of container-pip-deps.txt
The file container-pip-dependencies.txt was being left a directory when
building the docker image. This meant that it was being packaged when it
wasn't supposed to.

To avoid this, we remove file with the help from a context manager.

The change is minimal and the biggest part of the diff are indentation
changes.

Fixes #739
2024-03-05 17:54:34 +00:00
deeplow
4f08f99e93
Add release notes template
Simplifies the release announcement drafting by providing some
templates. It would have been preferable to be a .github config file,
but GitHub does not yet support content templates for release notes.
2024-03-05 14:48:37 +00:00
deeplow
41c48106fb
RELEASE.md: add check for verifying last-minute criticals 2024-03-05 14:46:05 +00:00
Alex Pyrgiotis
f75d471ec8
Fix OCR bug in Qubes Fedora 38 templates
Provide a fix for an OCR bug that affected Fedora 38 templates of Qubes
OS. In that specific configuration, the PyMuPDF version accepts the
Tesseract data directory only from the `TESSDATA_PREFIX` environment
variable. Our mistake was that we were setting this environment variable
in a dev script, instead of setting it for all configurations.

In this commit, we set an attribute in the fitz.fitz module, so that
both dev scripts and end-user installations can work. This is hacky, but
it targets an old PyMuPDF release after all, so we don't expect things
to break in the long run.

Fixes #737
2024-03-04 16:53:04 +02:00
Alex Pyrgiotis
d35eb56b4b
ci: Test Fedora 39 build instructions 2024-02-26 23:26:24 +02:00
deeplow
a5eb0a5f9d
README.md bump version to 0.6.0 2024-02-26 21:00:00 +02:00
Alex Pyrgiotis
f8984e4b49
Revert "README.md bump version to 0.6.0"
This reverts commit 2784260812.
2024-02-21 17:10:33 +02:00
Alex Pyrgiotis
5b6911af84
Properly add new file extensions
Accept `.svg` and `.bmp` files when browsing via the Dangerzone GUI.
Support for these extensions has already been added in the converter
code that runs in the sandbox (cd99122385)
but they were erroneously left out from the filter in the Dangerzone
main window.
2024-02-20 16:02:38 +02:00
Alex Pyrgiotis
e73f10f99b
Handle gracefully unknown error codes
Do not throw exceptions for unknown error codes. If
`get_proc_exception()` gets called from within an exception context and
raises an exception itself, then this exception will not get caught, and
it will get lost.

Prefer instead to return an exception class that we have for this
purpose, and show to the user the unknown error code of the converesion
process.
2024-02-20 16:00:35 +02:00
Alex Pyrgiotis
aeb8c33b6e
Update expected output for a QA scenario
Inform testers that the container code no longer returns "UNTRUSTED >"
strings in its output. Every string is trusted now, and the output will
be similar for container and Qubes isolation providers alike.
2024-02-20 16:00:35 +02:00
Alex Pyrgiotis
d376e1da00
tests: Adapt Qubes tests
Adapt Qubes tests to the addition of the conversion process in
doc_to_pixels() call.
2024-02-20 15:58:42 +02:00
Alex Pyrgiotis
bc55a64864
Appease lint checker 2024-02-20 15:55:46 +02:00
Alex Pyrgiotis
96cf5d0b4b
ci: Improve commit message lint
Improve the commit message check, by logging only the commit title, and
doing away with the extra spaces.
2024-02-20 15:55:45 +02:00
Alex Pyrgiotis
634523dac9
Get underlying error when conversion fails
When we get an early EOF from the converter process, we should
immediately get the exit code of that process, to find out the actual
underlying error. Currently, the exception we raise masks the underlying
error.

Raise a ConverterProcException, that in turns makes our error handling
code read the exit code of the spawned process, and converts it to a
helpful error message.

Fixes #714
2024-02-20 15:55:45 +02:00
Alex Pyrgiotis
6ee1d14c9a
Start conversion process earlier
Start the conversion process earlier, so that we have a reference to the
Popen object in case of an exception.
2024-02-20 15:55:45 +02:00
deeplow
e4a5dbce46
Don't show 50% duplicated progress info
50% would show twice in the conversion progress due to an overlap in
conversion progress values. The doc_to_pixels would be from 0-50% and
the pixels_to_pdf from 50%-100%.

This commit makes the first part go from 0 to 49% instead.

Fixes #715
2024-02-20 13:47:15 +00:00
deeplow
eb19926f9c
Update screenshots (hamburger menu + capitalization) 2024-02-20 13:45:38 +00:00
deeplow
2784260812
README.md bump version to 0.6.0 2024-02-20 13:45:38 +00:00
Alex Pyrgiotis
531a5bc96f
qa: Add extra actions in the Windows QA script 2024-02-19 17:13:57 +02:00
Alex Pyrgiotis
fd241e5964
qa: Consume stdin on Windows platforms
On Windows platforms, we can't consume the stdin using select(), because
it's not available for pipes [1]. We can instead consume it using some
native Windows calls.

[1]: From https://docs.python.org/3/library/select.html#select.select:

     "File objects on Windows are not acceptable, but sockets are. On
     Windows, the underlying select() function is provided by the
     WinSock library, and does not handle file descriptors that don’t
     originate from WinSock."
2024-02-19 17:13:57 +02:00
Etienne Perot
04508d9694
Check that image build was successful. 2024-02-19 15:37:50 +02:00
deeplow
e375624fdc
Bump Qubes Fedora on RELEASE.md
Fixes #712
2024-02-15 14:42:01 +00:00
deeplow
22ab6f65bf
Bump CodeQL upload action to V3 due to deprecation
The following warning was showing up in our conversion logs [1]:

| Warning: CodeQL Action v2 will be deprecated on December 5th, 2024.
| Please update all occurrences of the CodeQL Action in your workflow
| files to v3. For more information, see https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/

[1]: https://github.com/freedomofpress/dangerzone/actions/runs/7916735564/job/21611227503?pr=718
2024-02-15 14:40:33 +00:00
deeplow
f569695bb0
CI: Prevent fixup / wip commits 2024-02-14 13:15:27 +00:00
deeplow
75f8d76c5b
Appease new version of black lint tool 2024-02-13 11:36:10 +00:00
deeplow
7168a4078a
Bump poetry dependencies 2024-02-13 11:36:09 +00:00
deeplow
d2065ea76e
FIXUP: add clang-dev contribution 2024-02-13 11:12:19 +00:00
deeplow
9ddb9734ea
Update changelog for v0.6.0 2024-02-13 11:12:19 +00:00
deeplow
832775f34e
Bump version to 0.6.0 2024-02-13 11:12:19 +00:00
deeplow
8f11156ce4
Deprecate Ubuntu Lunar Lobster (EOL)
Fixes #705
2024-02-13 11:07:11 +00:00
Alex Pyrgiotis
2703448d60
Update Jammy build instructions regarding conmon
Update the build instructions for Ubuntu Jammy regarding conmon, now
that oldstable-proposed-updates no longer offers a patched conmon
package. Propose instead to install conmon from our apt-tools-prod repo.
2024-02-13 12:33:57 +02:00