mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 12:41:50 +02:00
Merge ca3e634b49
into 96aa56a6dc
This commit is contained in:
commit
0b1f2fec97
4 changed files with 48 additions and 2 deletions
5
BUILD.md
5
BUILD.md
|
@ -260,11 +260,16 @@ The following instructions require typing commands in a terminal in dom0.
|
||||||
|
|
||||||
```
|
```
|
||||||
qvm-create --class AppVM --label red --template fedora-40-dz dz
|
qvm-create --class AppVM --label red --template fedora-40-dz dz
|
||||||
|
qvm-volume resize dz:private $(numfmt --from=auto 5Gi)
|
||||||
```
|
```
|
||||||
|
|
||||||
> :bulb: Alternatively, you can use a different app qube for Dangerzone
|
> :bulb: Alternatively, you can use a different app qube for Dangerzone
|
||||||
> development. In that case, replace `dz` with the qube of your choice in the
|
> development. In that case, replace `dz` with the qube of your choice in the
|
||||||
> steps below.
|
> steps below.
|
||||||
|
>
|
||||||
|
> In the commands above, we also resize the private volume of the `dz` qube
|
||||||
|
> to 5GiB, since the Tesseract data that will be downloaded in the next steps
|
||||||
|
> take a bit of space.
|
||||||
|
|
||||||
4. Add an RPC policy (`/etc/qubes/policy.d/50-dangerzone.policy`) that will
|
4. Add an RPC policy (`/etc/qubes/policy.d/50-dangerzone.policy`) that will
|
||||||
allow launching a disposable qube (`dz-dvm`) when Dangerzone converts a
|
allow launching a disposable qube (`dz-dvm`) when Dangerzone converts a
|
||||||
|
|
|
@ -6,7 +6,7 @@ Take potentially dangerous PDFs, office documents, or images and convert them to
|
||||||
|  | 
|
|  | 
|
||||||
|--|--|
|
|--|--|
|
||||||
|
|
||||||
Dangerzone works like this: You give it a document that you don't know if you can trust (for example, an email attachment). Inside of a sandbox, Dangerzone converts the document to a PDF (if it isn't already one), and then converts the PDF into raw pixel data: a huge list of RGB color values for each page. Then, in a separate sandbox, Dangerzone takes this pixel data and converts it back into a PDF.
|
Dangerzone works like this: You give it a document that you don't know if you can trust (for example, an email attachment). Inside of a sandbox, Dangerzone converts the document to a PDF (if it isn't already one), and then converts the PDF into raw pixel data: a huge list of RGB color values for each page. Then, outside of the sandbox, Dangerzone takes this pixel data and converts it back into a PDF.
|
||||||
|
|
||||||
_Read more about Dangerzone in the [official site](https://dangerzone.rocks/about/)._
|
_Read more about Dangerzone in the [official site](https://dangerzone.rocks/about/)._
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ and newer platforms, we have to do the following:
|
||||||
- [ ] Create a new development environment with Poetry.
|
- [ ] Create a new development environment with Poetry.
|
||||||
- [ ] Build the container image and ensure the development environment uses
|
- [ ] Build the container image and ensure the development environment uses
|
||||||
the new image.
|
the new image.
|
||||||
|
- [ ] Download the OCR language data using `./install/common/download-tessdata.py`
|
||||||
- [ ] Run the Dangerzone tests.
|
- [ ] Run the Dangerzone tests.
|
||||||
- [ ] Build and run the Dangerzone .exe
|
- [ ] Build and run the Dangerzone .exe
|
||||||
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
||||||
|
@ -84,6 +85,7 @@ and newer platforms, we have to do the following:
|
||||||
- [ ] Create a new development environment with Poetry.
|
- [ ] Create a new development environment with Poetry.
|
||||||
- [ ] Build the container image and ensure the development environment uses
|
- [ ] Build the container image and ensure the development environment uses
|
||||||
the new image.
|
the new image.
|
||||||
|
- [ ] Download the OCR language data using `./install/common/download-tessdata.py`
|
||||||
- [ ] Run the Dangerzone tests.
|
- [ ] Run the Dangerzone tests.
|
||||||
- [ ] Create and run an app bundle.
|
- [ ] Create and run an app bundle.
|
||||||
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
||||||
|
@ -92,6 +94,7 @@ and newer platforms, we have to do the following:
|
||||||
- [ ] Create a new development environment with Poetry.
|
- [ ] Create a new development environment with Poetry.
|
||||||
- [ ] Build the container image and ensure the development environment uses
|
- [ ] Build the container image and ensure the development environment uses
|
||||||
the new image.
|
the new image.
|
||||||
|
- [ ] Download the OCR language data using `./install/common/download-tessdata.py`
|
||||||
- [ ] Run the Dangerzone tests.
|
- [ ] Run the Dangerzone tests.
|
||||||
- [ ] Create and run an app bundle.
|
- [ ] Create and run an app bundle.
|
||||||
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
||||||
|
@ -100,6 +103,7 @@ and newer platforms, we have to do the following:
|
||||||
- [ ] Create a new development environment with Poetry.
|
- [ ] Create a new development environment with Poetry.
|
||||||
- [ ] Build the container image and ensure the development environment uses
|
- [ ] Build the container image and ensure the development environment uses
|
||||||
the new image.
|
the new image.
|
||||||
|
- [ ] Download the OCR language data using `./install/common/download-tessdata.py`
|
||||||
- [ ] Run the Dangerzone tests.
|
- [ ] Run the Dangerzone tests.
|
||||||
- [ ] Create a .deb package and install it system-wide.
|
- [ ] Create a .deb package and install it system-wide.
|
||||||
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
||||||
|
@ -108,6 +112,7 @@ and newer platforms, we have to do the following:
|
||||||
- [ ] Create a new development environment with Poetry.
|
- [ ] Create a new development environment with Poetry.
|
||||||
- [ ] Build the container image and ensure the development environment uses
|
- [ ] Build the container image and ensure the development environment uses
|
||||||
the new image.
|
the new image.
|
||||||
|
- [ ] Download the OCR language data using `./install/common/download-tessdata.py`
|
||||||
- [ ] Run the Dangerzone tests.
|
- [ ] Run the Dangerzone tests.
|
||||||
- [ ] Create an .rpm package and install it system-wide.
|
- [ ] Create an .rpm package and install it system-wide.
|
||||||
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
- [ ] Test some QA scenarios (see [Scenarios](#Scenarios) below).
|
||||||
|
|
|
@ -3,14 +3,20 @@
|
||||||
import abc
|
import abc
|
||||||
import argparse
|
import argparse
|
||||||
import difflib
|
import difflib
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import selectors
|
import selectors
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
PYTHON_VERSION_STR = "3.12"
|
||||||
|
PYTHON_VERSION = [int(num) for num in PYTHON_VERSION_STR.split(".")]
|
||||||
|
EOL_PYTHON_URL = "https://endoflife.date/api/python.json"
|
||||||
|
|
||||||
CONTENT_QA = r"""## QA
|
CONTENT_QA = r"""## QA
|
||||||
|
|
||||||
To ensure that new releases do not introduce regressions, and support existing
|
To ensure that new releases do not introduce regressions, and support existing
|
||||||
|
@ -802,6 +808,26 @@ class QAWindows(QABase):
|
||||||
while msvcrt.kbhit():
|
while msvcrt.kbhit():
|
||||||
msvcrt.getch()
|
msvcrt.getch()
|
||||||
|
|
||||||
|
@QABase.task(f"Install the latest version of Python {PYTHON_VERSION_STR}", ref=REF_BUILD)
|
||||||
|
def install_python(self):
|
||||||
|
cur_version = list(sys.version_info[:3])
|
||||||
|
|
||||||
|
logger.info("Getting latest Python release")
|
||||||
|
with urllib.request.urlopen(EOL_PYTHON_URL) as f:
|
||||||
|
resp = f.read()
|
||||||
|
releases = json.loads(resp)
|
||||||
|
for release in releases:
|
||||||
|
if release["cycle"] == PYTHON_VERSION_STR:
|
||||||
|
latest_version = [int(num) for num in release["latest"].split(".")]
|
||||||
|
if latest_version > cur_version:
|
||||||
|
self.prompt(f"You need to install the latest Python version ({release['latest']})")
|
||||||
|
elif latest_version == cur_version:
|
||||||
|
logger.info(f"Verified that the latest Python version ({release['latest']}) is installed")
|
||||||
|
return
|
||||||
|
|
||||||
|
logger.error("Could not verify that the latest Python version is installed")
|
||||||
|
|
||||||
|
|
||||||
@QABase.task("Install and Run Docker Desktop", ref=REF_BUILD)
|
@QABase.task("Install and Run Docker Desktop", ref=REF_BUILD)
|
||||||
def install_docker(self):
|
def install_docker(self):
|
||||||
logger.info("Checking if Docker Desktop is installed and running")
|
logger.info("Checking if Docker Desktop is installed and running")
|
||||||
|
@ -816,12 +842,16 @@ class QAWindows(QABase):
|
||||||
)
|
)
|
||||||
def install_poetry(self):
|
def install_poetry(self):
|
||||||
self.run("python", "-m", "pip", "install", "poetry")
|
self.run("python", "-m", "pip", "install", "poetry")
|
||||||
self.run("poetry", "install")
|
self.run("poetry", "install", "--sync")
|
||||||
|
|
||||||
@QABase.task("Build Dangerzone container image", ref=REF_BUILD, auto=True)
|
@QABase.task("Build Dangerzone container image", ref=REF_BUILD, auto=True)
|
||||||
def build_image(self):
|
def build_image(self):
|
||||||
self.run("python", r".\install\common\build-image.py")
|
self.run("python", r".\install\common\build-image.py")
|
||||||
|
|
||||||
|
@QABase.task("Download Tesseract data", ref=REF_BUILD, auto=True)
|
||||||
|
def download_tessdata(self):
|
||||||
|
self.run("python", r".\install\common\download-tessdata.py")
|
||||||
|
|
||||||
@QABase.task("Run tests", ref="REF_BUILD", auto=True)
|
@QABase.task("Run tests", ref="REF_BUILD", auto=True)
|
||||||
def run_tests(self):
|
def run_tests(self):
|
||||||
# NOTE: Windows does not have Makefile by default.
|
# NOTE: Windows does not have Makefile by default.
|
||||||
|
@ -838,9 +868,11 @@ class QAWindows(QABase):
|
||||||
return "windows"
|
return "windows"
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
self.install_python()
|
||||||
self.install_docker()
|
self.install_docker()
|
||||||
self.install_poetry()
|
self.install_poetry()
|
||||||
self.build_image()
|
self.build_image()
|
||||||
|
self.download_tessdata()
|
||||||
self.run_tests()
|
self.run_tests()
|
||||||
self.build_dangerzone_exe()
|
self.build_dangerzone_exe()
|
||||||
|
|
||||||
|
@ -1005,6 +1037,10 @@ class QAFedora(QALinux):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class QAFedora41(QAFedora):
|
||||||
|
VERSION = "41"
|
||||||
|
|
||||||
|
|
||||||
class QAFedora40(QAFedora):
|
class QAFedora40(QAFedora):
|
||||||
VERSION = "40"
|
VERSION = "40"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue