Files
windmill/backend
Ruben FiszelandClaude Opus 5.5 c09038b106 fix: hold mcp token references to resource reference scopes (#11803)
* fix: require variables:read for the token variable of an mcp resource

A token scoped to resources:read/write on an MCP resource could have the API
decrypt the variable the resource's `token` points at and send it as a bearer
to the resource's URL. The url and header `$var:` references already required
variables:read on the variable; the token reference now does too, checked before
the OAuth refresh touches that variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: let an mcp resource's scope cover the variables it references

A scoped token reading or calling an MCP resource resolved its token variable
with the resource scope alone, but its url and header variables also needed
variables:read on each. The resource scope now covers all three; RLS still
bounds them to secrets the caller can read. Reverts the token-side check from
the previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: scope resource references when they are written, not when they are read

A token scoped to a resource now reads everything that resource references
(`$var:`, `$jsonvar:`, `$res:`), through get_value_interpolated and the MCP
tool routes alike. What makes that safe moves to the write: create, update,
update_value and version restore refuse a scoped token adding a reference it
holds no read scope on. References the stored value already carries are kept,
since whoever put them there was allowed to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: hold every resource reference writer to its own user's read rights

A resource-scoped reader resolves stored references as itself, so an unscoped
session could plant a reference to a secret its own user cannot read and have
a reader's scoped token resolve it. Adding a reference now also requires the
writer's user to see its target under RLS. A reference to nothing yet stays
allowed, since a promotion pushes resources before the secrets they use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: vet only variable references on write and keep nested resources scoped

A nested `$res:` brought along the variables of a resource the writer could see
but whose references it could not read, and what it references can change after
it is written. It needs its own read scope again, and the write check covers
only `$var:`/`$jsonvar:`.

An MCP token stored as a bare path resolved as a variable without being vetted
on write. It now needs its own variables:read scope, and the `$var:` prefix is
parsed with strip_prefix, as the write check does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep variable scopes on result-cache resources

The worker writes job output to g/results/<hash> straight to the table, so its
references never pass the write check. A token scoped to such a resource still
needs read scope on the variables it references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: require read rights on kept references and pin result-cache resources to g/results/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: check resource variable references at read time, with wildcard resource scopes covering matching variables

Returns to the read-time rule: a variable a resource references needs
variables:read on it, unless it is the resource's linked secret or a wildcard
pattern in the token's resources: scopes matches it. The MCP token reference is
now held to that rule like the url and header references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:28:29 +02:00
..
…
…
…
…
…
…
…
…

Windmill Backend

This folder holds all backend components, the src/ folder only contains files used to build the "root" binary.

Components

name description
windmill-api The API server, exposing functionality to other components and the frontend
windmill-audit Contains audit functionality, allowing different components to record important actions
windmill-common Common code shared by all crates
windmill-queue Contains job & flow queuing functionality, commonly written to by the API server and read from by workers
windmill-worker The worker. Used to process and execute flows & jobs.
parsers Contains code to parse signatures in different langauges.

Compile sqlx for offline ci

cargo sqlx prepare --workspace -- --bin windmill --features enterprise