Related: #3
feat: sanitize document when saving #117
Note
The build job for
560178da4ffinished with status success. Install and run the x86_64 test build with:curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6247229/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak flatpak install --user censor-dev.flatpak flatpak run --user page.codeberg.censor.Censor.Devel
@ -135,0 +150,4 @@
thumbnails=True,
xml_metadata=True)
except Exception as e:
print("WARNING: Sanitization of the document did not succeed")
add toast or warning dialog to UI
Done in !140.
@ -135,0 +144,4 @@
redactions=False,
redact_images=0,
# Do not remove links
remove_links=False,
Unsure about this option: the links may contain sensitive information, but maybe they should not be removed?
They are now kept by default in !140. Might add setting later.
@ -135,0 +146,4 @@
# Do not remove links
remove_links=False,
reset_fields=True,
reset_responses=True,
I am also unsure about these options. I can imagine that I filled a form and want to still redact some parts.
They are now removed by default in !140. Might add a setting later. Check influence.
@ -135,0 +139,4 @@
embedded_files=True,
hidden_text=True,
javascript=True,
metadata=True,
Check what exactly is redacted, it should be probably optional.
See #3 (comment). May make optional later. Now, with !140, metadata is removed by default.
@ -135,0 +137,4 @@
attached_files=True,
clean_pages=True,
embedded_files=True,
hidden_text=True,
Depends, check what it does.
May make optional later. Now, with !140, hidden text is removed by default.
@ -132,6 +132,26 @@ class Document:
images=pymupdf.PDF_REDACT_IMAGE_PIXELS,
graphics=pymupdf.PDF_REDACT_LINE_ART_REMOVE_IF_TOUCHED,
text=pymupdf.PDF_REDACT_TEXT_REMOVE)
try:
Split scrubbing for all options, thus, if it is failing for one, it still executes the rest.
Done in !140
-tmp.write(mupdf_document.tobytes(garbage=3))
+tmp.write(mupdf_document.tobytes(garbage=1, clean=True, deflate=True, deflate_images=True, deflate_fonts=True))
Decrease document size, sanitize better?
Edit: included in !140.
!140 includes the sanitization, thus, closing this PR here.
Pull request closed
Archived
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?