## Workflow conditions
Workflow conditions (`step.condition` and route `if`) are now parsed and interpreted by a small evaluator, `lib/condition.js`, instead of Node's `vm` module.
- **What it supports:** exactly what our workflows use:
- `state.*` and `params.*` lookups;
- `parseInt`, `parseFloat`, `Number`, `String`, `Boolean`;
- the string methods `trim`, `toLowerCase`, `toUpperCase`, `includes`, `startsWith`, `endsWith`;
- `|| && ! === !== == != < <= > >= + - * / %` with JavaScript semantics, plus literals and parentheses.
- **What it can't do:** read anything but the workflow's own data. Prototypes, globals and arbitrary calls are refused.
- **Compatibility:** each of the 26 conditions in the production workflows gives the same result as before, checked against 150 random states per condition.
- **Validation on save:** creating or updating a workflow with a condition that doesn't parse gets a 400 that names the step and the error.
## Admins only
- Only the `admin` group may use Pulse: the pages, the API and the live WebSocket. Employees now get 403.
- Creating a workflow requires admin, as editing already did.
- Gandalf and the workers use API keys and aren't affected.
## Tests
- Unit: 50 new evaluator tests (the production conditions, the language, refused inputs, size and nesting limits).
- Integration:
- employees are refused on pages and the API;
- invalid conditions are rejected on create and update.
- UI: the live-update test now finds its execution's row by id, because the list is capped at 50 rows.
Locally: jest 133/133, integration 39/39, Playwright passing; semgrep, lint and the dash check are clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Workflow conditions (step.condition and route `if`) are now parsed and
interpreted by lib/condition.js instead of being run with Node's vm
module. The language covers what workflows use: state/params lookups,
parseInt/parseFloat/Number/String/Boolean, a few string methods, the
usual operators with JavaScript semantics. Conditions can only read the
workflow's own data. Every condition in the production workflows gives
the same result as before (differential test, 150 random states each).
- Creating and updating a workflow rejects conditions that don't parse
(400 with the step and the error).
- Creating a workflow requires admin, like editing already did.
- Only the admin group may use Pulse (pages, API and live WebSocket);
employees get 403. Gandalf and workers use API keys and are unaffected.
- The live-update UI test finds its execution's row by id instead of
counting rows (the list is capped at 50).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared
merged commit e6dbb2869b into main2026-11-22 22:16:13 -05:00
jared
deleted branch safe-conditions2026-11-22 22:16:17 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Workflow conditions
Workflow conditions (
step.conditionand routeif) are now parsed and interpreted by a small evaluator,lib/condition.js, instead of Node'svmmodule.state.*andparams.*lookups;parseInt,parseFloat,Number,String,Boolean;trim,toLowerCase,toUpperCase,includes,startsWith,endsWith;|| && ! === !== == != < <= > >= + - * / %with JavaScript semantics, plus literals and parentheses.Admins only
admingroup may use Pulse: the pages, the API and the live WebSocket. Employees now get 403.Tests
Locally: jest 133/133, integration 39/39, Playwright passing; semgrep, lint and the dash check are clean.
🤖 Generated with Claude Code