feat(runner): render office documents and OCR text in the sandbox - #6
Merged
TomasPalsson merged 1 commit intoSep 28, 2026
Merged
Conversation
Add LibreOffice headless (impress/writer/calc-nogui) plus tesseract OCR to the sandbox-build rootfs so nsjail'd code can convert pptx/docx/xlsx to PDF (and on to PNG with pdftoppm) and OCR images in eng+isl. The jail mounts /usr read-only but not /etc, so soffice's registry/psprint symlinks into /etc are replaced with real files, and the default profile is pointed at the session workspace so a plain `soffice --headless --convert-to pdf` works without an -env:UserInstallation flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds office rendering and OCR to the
sandbox-buildrootfs (so bothlambda-microvm-runnerandlocal-oci-runtimeget it):libreoffice-impress-nogui,libreoffice-writer-nogui,libreoffice-calc-nogui:soffice --headless --convert-to pdffor pptx/docx/xlsx. Withpdftoppm(already installed) this gives slide/page PNGs.fonts-crosextra-carlito,fonts-crosextra-caladea: metric-compatible Calibri/Cambria, so Office layouts don't reflow.tesseract-ocrwithengandisl: the binarypytesseractneeds.Two jail fixes in one extra
RUN:/usrbut not/etc. Debian shipsmain.xcdandpsprint.confas symlinks into/etc, sosofficeaborts with a UNO RuntimeException. They are replaced with the real files.bootstraprcpoints the default profile at/mnt/data/.libreoffice, so a plainsoffice --headless --convert-to pdf x.pptxworks with no-env:UserInstallationflag, and the profile is reused across runs in the same session.Size
sandbox-build(arm64, uncompressed): 248.8 MB → 412.0 MB (+163 MB).Tests
Built
--platform linux/arm64 --target sandbox-buildand ran each case inside nsjail with the repo's seccomp policy:HOME=/mnt/data, no env overridesNote for review
The LibreOffice profile lives in the session workspace, so code from one turn can leave a profile macro that a later
sofficecall in the same session runs. It stays inside that user's own session (same trust level as the code that planted it), like ausercustomize.pyunder/mnt/data/.localalready does for Python, so no macro lockdown is added here.