Gotenberg migration

Seven security fixes in Marqius Kern: a beginner's guide to updating and testing

If you run Marqius Kern, updating the image is only part of this security change. You also need to turn on the settings that require a password and stop requests to private network addresses.

Marqius

Printed proofs with trim marks on an ivory proofing table

This guide explains the seven gaps found in our audit, then walks through the setup from an empty folder. You will start a local Marqius Kern server, check its version, test its password protection and turn a small HTML file into a PDF.

The commands use Marqius Kern 0.12.20, the release described in this audit. The walkthrough runs on port 3001 so it can sit beside an existing installation on port 3000. Near the end, there are separate instructions for applying the changes to an existing Docker Compose installation.

Disclosure: Simple AI LLC makes Marqius Kern and publishes this article. We used Gotenberg's public security advisories to look for problems in our own server. Gotenberg deserves credit for publishing those reports and fixes.

What we found, in plain language

A security advisory is a published explanation of a security problem: what can go wrong, which versions are affected and where the fix is available.

Marqius Kern supports Gotenberg's API. An API is the set of requests your application sends to a service, such as “convert this HTML file to PDF.” Because the two services accept similar requests, Gotenberg's advisories gave us a useful checklist for examining Marqius Kern.

We reviewed 49 advisory entries on 1 December 2026. The audit recorded:

Result

Count

What that means

Did not apply to Marqius Kern

20

The affected component or behaviour was absent.

Already defended, with tests

14

Marqius Kern had a protection and a test checking it.

Already defended, missing tests

8

The protection existed; we added tests for it.

Gaps that needed fixes

7

We changed the code and added tests.

Here is what the seven gaps mean for someone running the service.

Problem

A simple example

What changed

Some special network addresses slipped past the private-address block

A request could make Marqius Kern try an address that the operator expected to be blocked.

The address checks now cover additional IPv4 and IPv6 ranges.

Different spellings of a URL could bypass a rule

A rule could treat HTTP:// differently from http://.

Marqius Kern puts URLs into a consistent form before checking the rules.

A form with many repeated parts could keep the server busy

One upload request could contain thousands of fields with the same name.

Marqius Kern checks names more efficiently and checks the request deadline while reading the parts.

Repeated page selections could grow far too large

A request could ask for the same page thousands of times.

Marqius Kern counts the requested pages before building the full selection and rejects excessive requests.

Compressed PDF content could expand without the intended limit

A small-looking PDF attachment could need hundreds of megabytes when unpacked.

The decompression limit now applies across the steps used to unpack each PDF stream.

Downloads and archive entries stayed in memory

Several large files could consume the server's available RAM.

These inputs are written to temporary files as they arrive.

A failed webhook could put secrets in logs

A password or token in a cookie or extra header could appear in an error log.

The affected log messages no longer include those values.

A webhook is an address your application gives Marqius Kern so Marqius Kern can send a result back later. A log is the record of messages a server writes while it runs.

The audit's tests reproduced the seven gaps on 0.12.19 and passed after the fixes. The private-address blocking switches remain off by default, so the configuration below turns them on explicitly.

Before you start

Use Terminal on macOS or a Linux terminal. On Windows, use a WSL terminal connected to Docker Desktop. The commands below use shell syntax, so paste them into that terminal rather than PowerShell.

You need Docker running, the Docker Compose plugin, curl and openssl:

bash
docker --version
docker compose version
curl --version
openssl version
docker info

The first four commands should print version information. docker info should show information about the running Docker service. If it says it cannot connect, open Docker Desktop or start your Docker service, then try again.

Docker runs Marqius Kern inside a container, which is a separate running environment for the program. A Docker image is the packaged program used to create that container. Compose reads a small configuration file describing how to run it.

Step 1: Make a folder for this local example

Run:

bash
mkdir kern-security-demo
cd kern-security-demo

Run the remaining walkthrough commands from this folder. If the folder already exists, use a different new folder name so you do not overwrite an earlier example.

Step 2: Generate a password

The next commands generate a random password and save it in a file named .env:

bash
umask 077
printf 'GOTENBERG_API_BASIC_AUTH_PASSWORD=%s\n' "$(openssl rand -hex 24)" > .env
printf '.env\n' > .gitignore

openssl rand generates the password. umask 077 makes new files readable and writable only by your account. The .gitignore entry tells Git to leave the password file out of future commits.

The example username is kernuser. To read the password in your own terminal, run:

bash
cat .env

Copy only the characters after = into your password manager. Later, curl will ask you to enter this password. Your typing will not appear on the screen. Keep the .env contents out of screenshots, support messages and shared logs.

Step 3: Create the configuration file

Copy this whole block into your terminal, including the final YAML line. It creates a file named compose.yaml:

bash
cat > compose.yaml <<'YAML'
services:
  kern:
    image: marqius/kern:0.12.20
    ports:
      - "127.0.0.1:3001:3000"
    environment:
      GOTENBERG_API_BASIC_AUTH_USERNAME: kernuser
      GOTENBERG_API_BASIC_AUTH_PASSWORD: "${GOTENBERG_API_BASIC_AUTH_PASSWORD:?Set a password in .env}"
    command:
      - gotenberg
      - --api-enable-basic-auth=true
      - --chromium-deny-private-ips=true
      - --api-download-from-deny-private-ips=true
      - --webhook-deny-private-ips=true
      - --pdf-deny-private-ips=true
      - --api-timeout=30s
      - --pdf-max-stream-bytes=32MiB
    healthcheck:
      test: ["CMD", "curl", "--fail", "--silent", "http://localhost:3000/health"]
      interval: 10s
      timeout: 3s
      retries: 3
YAML

The word gotenberg in command is intentional: Marqius Kern accepts the compatible command name and flags.

Here is what the important settings do:

Setting

Why it is here

marqius/kern:0.12.20

Selects one specific release, so the version is visible in your configuration.

127.0.0.1:3001:3000

Makes Marqius Kern available on your computer at port 3001. Port 3000 is the port inside the container.

--api-enable-basic-auth=true

Requires the username and password for API calls.

--chromium-deny-private-ips=true

Blocks private addresses for page fetching.

--api-download-from-deny-private-ips=true

Blocks private addresses for files fetched through downloadFrom.

--webhook-deny-private-ips=true

Blocks private addresses as webhook destinations.

--pdf-deny-private-ips=true

Blocks private addresses for the PDF timestamp service.

--api-timeout=30s

Sets a 30-second request time limit for this example.

--pdf-max-stream-bytes=32MiB

Limits how far an individual PDF stream may expand when decoded.

The 32 MiB value is a strict example setting. It is not an upload limit or a cap on the container's total RAM. A PDF stream is one block of data inside a PDF, such as image or attachment content. A document can contain several streams. Legitimate large documents may need a higher limit; test your own files before adopting this value in production.

Blocking private addresses can also block something your application intentionally uses, such as an internal image server or webhook receiver. Check those dependencies before applying these settings to an existing service.

Step 4: Download and start Marqius Kern

Check the configuration, download the image and start the service:

bash
docker compose config --quiet
docker compose pull kern
docker compose up -d --wait kern
docker compose ps

Run them in order. If a command fails, fix that error before continuing.

config --quiet checks the Compose file without printing its resolved contents, which include the password. pull downloads the image. up -d starts the service in the background. --wait waits for the health check to pass.

The final command should show the kern service running and healthy. If it does not, read the startup messages:

bash
docker compose logs --tail=50 kern

Step 5: Check that Marqius Kern is responding

Run:

bash
curl --fail --silent --show-error \
  http://127.0.0.1:3001/health

Look for "status":"up" in the response. The health endpoint answers without a password so monitoring systems can check it. A successful health check does not test password protection. We will test that separately.

Now ask for the version, including the response headers:

bash
curl --fail --silent --show-error \
  --user kernuser \
  --dump-header - \
  http://127.0.0.1:3001/version

Enter the password from Step 2 when prompted. Look for a header like:

text
X-Marqius-Kern: marqius-kern 0.12.20

Header names may use different capitalisation. The number in that header is the Marqius Kern version.

The response body may say 8.40.0 or 9.10.3. That is the Gotenberg API version Marqius Kern reports for compatibility, so use the Marqius Kern header when checking which Marqius Kern release you are running.

Step 6: Check that a request without a password is refused

Run this command without --user:

bash
curl --silent --show-error \
  --output /dev/null \
  --write-out 'HTTP status: %{http_code}\n' \
  http://127.0.0.1:3001/version

The expected result is:

text
HTTP status: 401

401 means the request did not provide acceptable credentials. In this test, that is the result you want.

If it returns 200, check that basic authentication is enabled in compose.yaml, run docker compose up -d --wait kern again and repeat the test. Also check that you are calling port 3001, where this example is running.

Step 7: Create your first PDF

First, create a small HTML file. HTML is the format used to describe a web page:

bash
cat > index.html <<'HTML'
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>My first Marqius Kern PDF</title>
  </head>
  <body>
    <h1>Invoice 1001</h1>
    <p>This PDF was created by my local Marqius Kern server.</p>
  </body>
</html>
HTML

Send that file to Marqius Kern:

bash
curl --fail --silent --show-error \
  --user kernuser \
  --form 'files=@index.html' \
  --output first-kern.pdf \
  --write-out 'HTTP status: %{http_code}\n' \
  http://127.0.0.1:3001/forms/chromium/convert/html

Enter your password when prompted. --form uploads the HTML file, and --output saves the response as first-kern.pdf.

The expected status is 200. Open first-kern.pdf from the folder and check that it contains “Invoice 1001” and the sentence below it.

On macOS, you can open it with:

bash
open first-kern.pdf

On a Linux desktop, use:

bash
xdg-open first-kern.pdf

You have now checked three separate things: the service is running, unauthenticated calls are refused and an authenticated conversion produces a readable PDF.

Step 8: Apply the changes to an existing Compose installation

The walkthrough above created a separate local instance. It has not upgraded your existing deployment.

If your existing Marqius Kern service uses Docker Compose, open the terminal in the folder containing its Compose file. The commands below assume that file is called compose.yaml and the service is called kern. Use your actual filename and service name if they differ. For example, a service still named gotenberg needs gotenberg in place of kern in the service commands.

Back up the existing configuration and list its service names:

bash
cp -p compose.yaml "compose.yaml.backup-$(date +%Y%m%d-%H%M%S)"
docker compose config --services
docker compose ps

Edit the existing Marqius Kern service in your text editor:

  1. Set its image to marqius/kern:0.12.20. If you use the image with bundled fonts, use marqius/kern:0.12.20-fonts.
  2. Add the authentication setting and credentials from Step 3, using your deployment's own password. Update the calling application to send those credentials as well.
  3. Add the private-address blocking settings after checking whether your application depends on internal URLs.
  4. Choose the timeout and PDF stream limit using your real documents. The walkthrough values are examples.

Merge these settings into the existing configuration. Keep the network, storage, licence and other application-specific settings your deployment needs. If the calling application runs in another container, it normally uses the Compose service address, such as http://kern:3000; 127.0.0.1 inside that application container refers to the application container itself.

Then run:

bash
docker compose config --quiet
docker compose pull kern
docker compose up -d --wait kern
docker compose ps

The up command recreates the service when the image or configuration has changed, so plan for that restart. A plain docker compose restart does not apply a new image or changed environment settings.

Repeat the version, authentication and conversion checks against your existing service's address. Finally, send a representative document through your own application to check the complete workflow.

The walkthrough uses HTTP on your own computer. If credentials travel across a network, use an HTTPS endpoint or an encrypted connection. Basic authentication supplies a username and password; it does not encrypt the connection itself.

Step 9: Replace any webhook secrets that appeared in old logs

This step matters if an older Marqius Kern version handled webhooks containing secrets in cookies or extra headers.

Updating changes what future log messages contain. It does not remove values already written to old logs.

Check the logs in the system where you keep them. If a secret was recorded:

  1. Create a replacement credential in the service that issued it.
  2. Update the application that sends the webhook settings to use the replacement.
  3. Send a test conversion and confirm that the webhook reaches its destination.
  4. Revoke the old credential.
  5. Restrict access to the affected logs and handle retained copies under your normal log-retention process.

There is no single Marqius Kern command to rotate every kind of token: the replacement comes from the service that owns that credential.

If a command fails

What you see

What to check

docker: command not found

Install Docker and reopen your terminal.

Docker cannot connect to its daemon

Open Docker Desktop or start the Docker service.

unknown flag: --wait

Check that you are using a current Docker Compose plugin with docker compose, then retry.

manifest unknown or image tag not found

Check the image name and whether the release containing the fixes is available. If it is not, wait for that release; do not assume another tag contains the fixes.

Port 3001 is already allocated

Change only the host port to 127.0.0.1:3002:3000, start the service again and use port 3002 in the curl commands.

curl: (7) Failed to connect

Run docker compose ps and docker compose logs --tail=50 kern; check the service and port.

401 on the authenticated test

Use username kernuser and the password after = in .env. If you changed .env, recreate the service with docker compose up -d --wait kern.

A previously working internal URL is rejected

Check whether the private-address rules now block that destination. Decide how that internal dependency should be reached before changing the rules.

A large PDF is rejected

Read the error and check the configured stream limit. Test a higher value with a representative document if the document legitimately needs it.

What to test next

These steps check startup, version, authentication and one conversion. They do not reproduce every attack from the audit or measure behaviour under heavy traffic.

The audit also records work still to do: some PDF splitting and Gotenberg 9 processing stages hold output in memory until it is sent. The stream limit in this guide does not cap all of that memory use.

Next, test documents that look like your real workload: a typical invoice, a large report, a document with images and a request that uses your webhook. Check the finished files and watch the service's memory while those requests run:

bash
docker stats

Press Ctrl+C to leave the live display; that stops the display, not the containers.

When you have finished with the separate tutorial instance, return to its kern-security-demo folder and run:

bash
docker compose down

That removes the tutorial's containers and Compose network. Your local configuration, password file and example PDF remain in the folder.

Further reading