Skip to content

feat(runner): render office documents and OCR text in the sandbox - #6

Merged
TomasPalsson merged 1 commit into
fix/nsjail-no-cgroup-clonefrom
feat/runner-office-render
Sep 28, 2026
Merged

TomasPalsson merged 1 commit into
fix/nsjail-no-cgroup-clonefrom
feat/runner-office-render

Conversation

@TomasPalsson

Copy link
Copy Markdown

What

Adds office rendering and OCR to the sandbox-build rootfs (so both lambda-microvm-runner and local-oci-runtime get it):

  • libreoffice-impress-nogui, libreoffice-writer-nogui, libreoffice-calc-nogui: soffice --headless --convert-to pdf for pptx/docx/xlsx. With pdftoppm (already installed) this gives slide/page PNGs.
  • fonts-crosextra-carlito, fonts-crosextra-caladea: metric-compatible Calibri/Cambria, so Office layouts don't reflow.
  • tesseract-ocr with eng and isl: the binary pytesseract needs.

Two jail fixes in one extra RUN:

  • The jail mounts /usr but not /etc. Debian ships main.xcd and psprint.conf as symlinks into /etc, so soffice aborts with a UNO RuntimeException. They are replaced with the real files.
  • bootstraprc points the default profile at /mnt/data/.libreoffice, so a plain soffice --headless --convert-to pdf x.pptx works with no -env:UserInstallation flag, 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-build and ran each case inside nsjail with the repo's seccomp policy:

Case Result
pptx → pdf → png (4 slides → 4 PNGs) pass
docx → pdf pass
xlsx → pdf pass
profile reused by a second, separate jail (cold ~1 s, warm <1 s) pass
tesseract lists eng + isl, OCRs a rendered page incl. þæð pass
default jail HOME=/mnt/data, no env overrides pass

Note for review

The LibreOffice profile lives in the session workspace, so code from one turn can leave a profile macro that a later soffice call in the same session runs. It stays inside that user's own session (same trust level as the code that planted it), like a usercustomize.py under /mnt/data/.local already does for Python, so no macro lockdown is added here.

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.
@TomasPalsson
TomasPalsson marked this pull request as ready for review September 28, 2026 15:15
@TomasPalsson
TomasPalsson merged commit 380589e into fix/nsjail-no-cgroup-clone Sep 28, 2026
10 checks passed
@TomasPalsson
TomasPalsson deleted the feat/runner-office-render branch September 28, 2026 15:16
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.

1 participant