Security (fixed in #60): workflow conditions were evaluated with Node's vm module #62

Closed
opened 2026-11-22 22:47:18 -05:00 by jared · 0 comments
Owner

Status: fixed in #60 and deployed as e6dbb28 on 2026-11-22. I'm recording it now that the fix is live.

What it was

Workflow conditions (step.condition and route if) were evaluated with vm.runInNewContext. Node's vm module is not a security boundary: an expression running in a vm context can reach the host process. So anyone who could save a workflow could run code inside the Pulse server process, which runs as root on CT 122 and has the database credentials and the Gandalf and worker keys.

Who could save a workflow:

  • Before #60: any Authelia user that Pulse admitted. Pulse let in the admin and employee groups, and creating a workflow had no admin check, although editing did.
  • In practice: Authelia only lets the admin group reach pulse.lotusguild.org, with two-factor. So exposure was limited to admins, who can already run root commands on the workers.

I confirmed the problem only on a local test instance. Nothing was tried against production.

The fix (#60)

  • Conditions are parsed and interpreted by lib/condition.js, a small evaluator that can only read the workflow's own state and params, call a short allowlist of functions and string methods, and use ordinary operators. No JavaScript engine is involved.
  • Each of the 26 conditions in the production workflows gives the same result as before, checked against 150 random states per condition.
  • Workflows with conditions that don't parse are rejected when saved.
  • Creating a workflow requires admin.
  • Pulse itself now admits only the admin group (pages, API, WebSocket), matching Authelia. The only accounts that lost access were three old test accounts that were employee-only.

Follow-ups

  • None needed for this bug.
  • Related, and unchanged: the server and worker run as root. Worth revisiting if Pulse ever admits non-admins again.
**Status:** fixed in #60 and deployed as `e6dbb28` on 2026-11-22. I'm recording it now that the fix is live. ## What it was Workflow conditions (`step.condition` and route `if`) were evaluated with `vm.runInNewContext`. Node's `vm` module is **not a security boundary**: an expression running in a vm context can reach the host process. So anyone who could save a workflow could run code inside the Pulse server process, which runs as root on CT 122 and has the database credentials and the Gandalf and worker keys. Who could save a workflow: - **Before #60:** any Authelia user that Pulse admitted. Pulse let in the `admin` and `employee` groups, and creating a workflow had no admin check, although editing did. - **In practice:** Authelia only lets the `admin` group reach `pulse.lotusguild.org`, with two-factor. So exposure was limited to admins, who can already run root commands on the workers. I confirmed the problem only on a local test instance. Nothing was tried against production. ## The fix (#60) - Conditions are parsed and interpreted by `lib/condition.js`, a small evaluator that can only read the workflow's own `state` and `params`, call a short allowlist of functions and string methods, and use ordinary operators. No JavaScript engine is involved. - Each of the 26 conditions in the production workflows gives the same result as before, checked against 150 random states per condition. - Workflows with conditions that don't parse are rejected when saved. - Creating a workflow requires admin. - Pulse itself now admits only the `admin` group (pages, API, WebSocket), matching Authelia. The only accounts that lost access were three old test accounts that were employee-only. ## Follow-ups - None needed for this bug. - Related, and unchanged: the server and worker run as root. Worth revisiting if Pulse ever admits non-admins again.
jared closed this issue 2026-11-22 22:47:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/pulse#62