Skip to content

Split dangerzone image to a separate repository#1459

Open
almet wants to merge 16 commits intomainfrom
split-dangerzone-image
Open

Split dangerzone image to a separate repository#1459
almet wants to merge 16 commits intomainfrom
split-dangerzone-image

Conversation

@almet
Copy link
Copy Markdown
Member

@almet almet commented Apr 10, 2026

Note

These changes come together with the https://github.com/freedomofpress/dangerzone-image repository, so be sure to review the code there as well.

This branch removes the in-tree container image (build, conversion code, Dockerfiles) and rewires the client-side code to consume the published image from the new freedomofpress/dangerzone-image repository. The bulk of the diff is deletions plus the test/CI changes, which don't test every supported format locally (it's done on the dangerzone-image repo now)

Look at the individual commits for more details.

Worth noting: this makes the tests stop popping on our dev machines, by setting the QT_QPA_PLATFORM env var to offscreen (there is still the possibility to pass the --onscreen flag to pytest if required)

@almet almet force-pushed the split-dangerzone-image branch 2 times, most recently from df4725e to 6ecb6a9 Compare April 10, 2026 12:59
Comment thread THIRD_PARTY_NOTICE.md
Comment thread pyproject.toml Outdated
Copy link
Copy Markdown
Contributor

@apyrgio apyrgio left a comment

Choose a reason for hiding this comment

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

Amazing work Alexis! My review comments are pretty minor, I think we're very close to merging this.

Comment thread .github/workflows/ci.yml
Comment thread .gitignore Outdated
Comment thread CHANGELOG.md Outdated
Comment thread pyproject.toml Outdated
Comment thread dangerzone/isolation_provider/qubes.py Outdated
Comment on lines 86 to 100
def teleport_dz_module(self, wpipe: IO[bytes]) -> None:
"""Send the dangerzone module to another qube, as a zipfile."""
# Grab the absolute file path of the dangerzone module.
import dangerzone as _dz
"""Send the conversion module to another qube, as a zipfile."""
# Grab the absolute file path of the conversion module.
import conversion as _conv

_conv_path = Path(_dz.conversion.__file__).parent
_src_root = Path(_dz.__file__).parent.parent
_conv_path = Path(_conv.__file__).parent
temp_file = io.BytesIO()

with zipfile.ZipFile(temp_file, "w") as z:
z.mkdir("dangerzone/")
z.writestr("dangerzone/__init__.py", "")
for root, _, files in os.walk(_conv_path):
for file in files:
if file.endswith(".py"):
file_path = os.path.join(root, file)
relative_path = os.path.relpath(file_path, _src_root)
relative_path = os.path.relpath(file_path, _conv_path.parent)
z.write(file_path, relative_path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note to self to test this part in Qubes.

Comment thread tests/conftest.py
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
The conversion error classes used to live under dangerzone/conversion/
which is the code that runs inside the container. Now that the
container image lives in a separate repository, the "client" side needs
its own copy of the error types and shared constants (DEFAULT_DPI,
INT_BYTES, MAX_PAGES) so it can decode the integer error codes that
cross the sandbox boundary.

This is now in dangerzone/conversion_errors.py with the ConversionException
hierarchy and the constants that the client needs. Isolation provider tests
have been modified to use this new location.
@almet almet force-pushed the split-dangerzone-image branch from d6bcf46 to 29ebe10 Compare April 20, 2026 10:33
almet added 8 commits April 20, 2026 17:15
The container image build, the conversion code that runs inside it,
and the related CI/Dockerfiles now live in the freedomofpress/
dangerzone-image repository. Remove them from this repo and rewire
the build pipeline to consume the published container image instead
of building it in this repo.

This drops the following folders and files: conversion/,
container_helpers/, the Dockerfiles, the in-tree image build scripts, and
updates ci.yml to call `dangerzone-image prepare-archive` against the published
image rather than building it locally.
Now that the container image (and the actual format conversion) lives
in a separate repo, this repo only needs to test the client-side
interface to the sandbox, not the round-trip conversion of every
supported format. Drop the per-format sample documents, their
reference PDFs, the external HWP fixtures, the 11k-page compressed
fixture, and the test_large_set.py module.

Also drop the tests that exercised the now-removed conversion code:
test_max_pages_server_enforcement (this is the container repo's concern) and
the TestExtraFormats CLI test for HWP.
With the format-specific assets gone, the GUI and isolation provider
tests no longer need a non-PDF document to drive their drag-drop and
multi-document scenarios.

Also refresh sample-pdf.pdf and its reference output to the latest
version.
Set QT_QPA_PLATFORM=offscreen in tests/gui/conftest.py so the GUI test
suite renders without a display server. Add an `--onscreen` opt-out
for local debugging.

With offscreen rendering in place, the CI job no longer needs to
install xvfb, start an Xvfb server, or wrap the test command in
xvfb-run. Drop all of that and pass `--no-gui` to dev_scripts/env.py
so it doesn't try to forward the (now nonexistent) host X socket into
the container.
Mark the container-backed tests (tests/isolation_provider/test_container.py
and TestCliConversion in tests/test_cli.py) and the GUI tests as
belonging to dedicated xdist groups so pytest-xdist runs each group
on a single worker. This avoids contention over the container runtime
and the offscreen Qt platform when running tests in parallel.

Also register the xdist_group marker via addinivalue_line so it
doesn't trigger PytestUnknownMarkWarning when pytest-xdist isn't
installed (the marker is then a no-op), and group otherwise-ungrouped
tests by file in tests/conftest.py so they never accidentally land on
the container or gui worker.
The DangerzoneGui.__init__ logic that orders MIME handlers walks
$XDG_DATA_DIRS to find .desktop files. Pin XDG_DATA_DIRS to a known
value in the three GUI logic tests that exercise this path so the
tests don't pick up arbitrary entries from the developer's or CI
runner's environment.
Bump vfkit to 0.6.3 (now signed upstream, so use vfkit-unsigned and
relax the version pin to >=0.6.1) and cosign to 2.6.3 in mazette.lock,
and refresh the mazette config_checksum.

Regenerate poetry.lock with Poetry 2.3, which adds platform/group
markers to a couple of entries.
@almet almet force-pushed the split-dangerzone-image branch from 16c9cd1 to f9bc177 Compare April 20, 2026 15:15
@almet
Copy link
Copy Markdown
Member Author

almet commented Apr 21, 2026

I've fixed the CI issue doing the E2E update, and I did this by changing how the old-latest images are tagged on the dangerzone-image repository.

It now tags old-latest only if it's different from the latest, and only if there are changes. For feature branches, we copy the old-latest from the main git branch.

Last item pending is the test on Qubes, and we should be good to merge!

apyrgio added 7 commits April 23, 2026 21:29
Modify the RPM package now that dangerzone-insecure-converter-qubes
covers the server-side aspect of the conversion.
Now that the server-side components are not bundled in the Dangerzone
repo, we need to slightly modify the teleport trick we did.

The change is that we no longer import the `conversion` module, but we
look for the source of the `dangerzone-insecure-converter` module via
the `DANGERZONE_INSECURE_CONVERTER_PATH` envvar. Note that this is a
dev-only argument.
Update the build instructions for Qubes, now that we have a separate
component for the server-side part of the conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants