Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

container: Allow converting more document formats #378

Merged
merged 2 commits into from
Mar 28, 2023
Merged

Conversation

apyrgio
Copy link
Contributor

@apyrgio apyrgio commented Mar 27, 2023

Remove the association between MIME types and export filters, because
LibreOffice is able to auto-detect them on its own. Instead, ask
LibreOffice to simply convert the document to a .pdf.

This association was cumbersome for yet another reason; there are MIME
types that may be associated with more than one file type. That's why
it's better to let LibreOffice decide the proper filter for the
conversion.

Our current understanding is that this change won't widen our attack
surface for the following reasons:

  • The output filters for PDF documents are pretty specific, and we don't
    affect the input filters somehow.
  • The default behavior of LibreOffice on Alpine Linux is to disable
    macros.
  • We preemptively run LibreOffice in safe mode, to remove hardware
    acceleration and make sure that macros are not invoked as well.

Closes #369

(must be merged after #377)

@apyrgio apyrgio changed the base branch from main to release-0.4.1 March 28, 2023 11:30
Remove the association between MIME types and export filters, because
LibreOffice is able to auto-detect them on its own. Instead, ask
LibreOffice to simply convert the document to a .pdf.

This association was cumbersome for yet another reason; there are MIME
types that may be associated with more than one file type. That's why
it's better to let LibreOffice decide the proper filter for the
conversion.

Our current understanding is that this change won't widen our attack
surface for the following reasons:

* The output filters for PDF documents are pretty specific, and we don't
  affect the input filters somehow.
* The default behavior of LibreOffice on Alpine Linux is to disable
  macros.

Closes #369
The main use of safe mode [1] in LibreOffice is to run with a fresh user
profile, in case the default one got borked somehow. This is actually
not a concern of ours, since the user's profile is in the container and
is not persistent.

The main reason we want to preemptively run LibreOffice in safe mode is
to remove hardware acceleration capabilities. Whether hardware
acceleration actually works in a container is another question, but we
want to be extra sure.

[1]: https://help.libreoffice.org/latest/en-US/text/shared/01/profile_safe_mode.html
@apyrgio apyrgio merged commit 58a8241 into release-0.4.1 Mar 28, 2023
apyrgio added a commit that referenced this pull request Apr 3, 2023
In PR #378 ("container: Allow converting more document formats"), we
added support for the following MIME types:

* application/zip
* application/octet-stream
* application/x-ole-storage
* application/vnd.oasis.opendocument.spreadsheet-template
* application/vnd.oasis.opendocument.text-template

However, we forgot to add some tests for these MIME types in the repo.
In this commit, we add a file for each of these MIME types, to make sure
we have no regressions in the future.
@deeplow deeplow deleted the 369-mimes branch May 11, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incomplete MIME type support
2 participants