Skip to content

Releases

function-wasm-v1.1.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 23 Nov 12:30
b082a58

function-wasm 1.1.0 moves the runtime to Wasmtime 51.0.0 and function-sdk-rust 0.6.0. Wasmtime 51.0.0 fixes a crash that a module could cause on 1.0.0 to 1.0.2 by declaring a function subtype, so an installation that runs modules it doesn't fully trust should upgrade. The runtime also answers RunFunction with UNAVAILABLE until warm-up ends. The Input, the flags, the manifest and the world are unchanged.

Before you upgrade

From 1.0.0 or 1.0.1, read "Before you upgrade" in the notes of the releases you skip, 1.0.1 and 1.0.2: 1.1.0 contains their fixes and the checks they added.

Check modules that keep dozens of async operations in flight. Wasmtime 51 limits the fibers alive at once in a store to 64 by default (Wasmtime #14971), and Wasmtime 50 had no limit. A fiber backs guest code that Wasmtime calls asynchronously, as the runtime calls run, and the component model's async primitives use more. The runtime keeps the default and gives each run a store of its own, so a run that needs more fibers ends in a fatal result with Wasmtime's store limit of fibers has been reached. The go, python, rust and ts scaffolds pass the guest suite under the limit unchanged.

Security

A module could crash the runtime process

function-wasm 1.0.0 to 1.0.2 link Wasmtime 50.0.1, built without its gc feature. Such a build still accepts the function subtypes of the GC proposal, but the builtin that checks a function against a subtype at run time is a stub that panics, and a panic in compiled code can't unwind. A call_indirect that finds a function of a declared subtype in its table makes that check, and so do the casts the GC proposal adds. The crash ends every request the pod is serving, and a module doesn't need a grant to cause it. Wasmtime 51.0.0 has a working check in every build, and the engine now refuses function subtypes at compile as well (GHSA-rc4p-x33f-vpr2, #432, #435).

Advisories that don't affect function-wasm

Wasmtime 51.0.0 also fixes these advisories against 50.0.1:

Advisory Why function-wasm isn't affected
GHSA-5m8g-xhq4-4h93 A module's stdout and stderr are the host's own, which wasmtime-wasi writes without AsyncWriteStream.
GHSA-f8mm-ggr3-89wh The runtime reads a request body whole and sends it with its own client, which isn't built with HTTP/2. wasmtime-wasi-http's sender is compiled out.
GHSA-43j2-gcp4-m22g GC types are compiled out, and no host function hands a module a GC reference.
GHSA-wvgq-g5hf-6gm6 The runtime keeps Wasmtime's default memory reservation.
GHSA-2674-w29h-wqvj The threads proposal is never enabled.
GHSA-xrvr-8678-5wp8 The runtime never passes a stream or future from one component instance to another.
GHSA-hj27-mpw9-ff4c It affects core modules, and the runtime runs components.
GHSA-f2pq-268w-886c It affects Windows hosts, and the image is Linux.

For operators

RunFunction waits for warm-up

With --warm-modules set, the runtime listens at once and loads the listed modules before it reports ready. 1.0.2 served a RunFunction call that arrived in that time cold. 1.1.0 answers it with UNAVAILABLE (the function is not ready) and runs nothing, so Crossplane fails that reconcile of the composite resource and tries again later. Crossplane's function Deployment has no readiness probe by default. Until a DeploymentRuntimeConfig adds one on /readyz, a composite resource can show rpc error: code = Unavailable desc = the function is not ready while a new pod warms up (Readiness, #422).

Each request is decoded and encoded whole

The runtime now decodes the request and the module's response into the SDK's messages and encodes both again. 1.0.2 decoded them too, but passed on the bytes it had received. Encoding adds host time that grows with the number of composed resources a request has. The difference against 1.0.2 isn't measured (#422).

Large policies and compiled artifacts cost less

A new compositionPolicy compiles outside the lock of the cache that keeps compiled policies, so requests with another policy no longer wait for it: a 200-rule policy takes about 50 ms to compile (#384). The runtime checks a compiled artifact read from disk through a 64 KiB buffer, and no longer reads the whole artifact into memory to check it (#377).

A failed load is retried by one request

After a module failed to load, the requests waiting on that load and a request arriving meanwhile could each fetch and compile the module. One request at a time now retries a failed load, and the others wait for it (#384).

A quantity whose fraction overflows is refused

A limits.memory whose fraction overflowed when multiplied by its suffix wrapped around in a release build, to a value admission still held to --module-memory-limit. The runtime now refuses it with limits.memory "…" is not a valid quantity, and refuses a limits.timeout whose fraction overflows with limits.timeout "…" is not a valid duration (#384).

The timeout outcome of the run histogram

guestfn_module_run_duration_seconds counted a run under timeout when its error contained the deadline sentence, which a module could return in an error of its own. The outcome now comes from how the run ended (Metrics, #384).

For module authors

The runtime re-encodes the request and the response

In 1.0.x, docs/abi-v2.md promised that the host passes the caller's request bytes to run and returns the module's response bytes verbatim. 1.1.0 withdraws that promise: the runtime decodes both and encodes them again. A module receives every field it did before, including fields newer than the runtime's copy of the proto, and can't depend on the layout of the bytes (ABI v2, #422).

Function subtypes and typed function references are refused

docs/abi-v2.md has said since 1.0.0 that the engine refuses GC and function references at compile. The engine didn't: with the gc crate feature off, Wasmtime still accepted function subtypes and call_ref. 1.1.0 switches both proposals off, so a module that uses either fails with cannot compile module: …, as the documentation says. No scaffold or example uses them (ABI v2, #435).

World, Wasmtime and WASI versions

Serves guestfn:function@1.0.0 on Wasmtime 51.0.0: WASI 0.2.12 (cli, clocks, http, io) for the sync scaffolds and WASI 0.3.0 (cli, clocks, http) for the rust scaffold. The world and the WASI versions haven't moved since 1.0.0.

Merged pull requests

Read more

function-wasm-v1.0.3

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 23 Nov 12:58
0a8b6b6

Caution

This is a security release, and every installation of 1.0.0, 1.0.1 or 1.0.2 should upgrade. Whoever chooses the module a step runs could crash the runtime, and with it every Composition the function serves.

function-wasm 1.0.3 moves Wasmtime from 50.0.1 to 50.0.3, which fixes that crash. The Input, the flags, the manifest and the world are unchanged, and a module built for 1.0.0 runs without a rebuild.

Security

A module could crash the runtime

function-wasm builds Wasmtime without its gc feature. Wasmtime 50.0.1 built that way still accepts the function subtypes of the WebAssembly GC proposal, and its run-time subtype check is a stub that panics. The panic can't unwind out of compiled code, and the process aborts. A component whose call_indirect finds a function of a declared subtype in its table triggers it, with no grant. A Composition could name such a module, or the composite resource could through module.from where the policies permit its location. Each reconcile that ran it ended the runtime process and every run in flight.

The ABI v2 contract says the engine refuses the GC proposal at compile, and it doesn't: 1.0.3 compiles such a module and runs it (GHSA-rc4p-x33f-vpr2, #436).

Other advisories

The same Wasmtime releases fix eight more advisories. Each needs something the runtime doesn't do or use:

Advisory What it needs
GHSA-5m8g-xhq4-4h93 an output stream backed by AsyncWriteStream; a guest's stdout and stderr aren't
GHSA-43j2-gcp4-m22g a host function that returns GC references
GHSA-xrvr-8678-5wp8 two component instances in one store; every run has a store of its own
GHSA-hj27-mpw9-ff4c a core module; the runtime serves components only
GHSA-wvgq-g5hf-6gm6 a memory that can't move, with a reservation that isn't a multiple of the page size
GHSA-2674-w29h-wqvj the threads proposal turned on in a build without the threads feature
GHSA-f8mm-ggr3-89wh a wasi:http body sent over HTTP/2 by Wasmtime's own client; the runtime sends through its egress client
GHSA-f2pq-268w-886c a Windows host

1.0.3 also moves url to 2.5.9 (RUSTSEC-2026-0592, #436). Before it, Url::origin overflowed the stack on a deeply nested blob: URL. 1.0.1 called it on a manifestURL of any scheme, and whoever chose the module could crash 1.0.1 with one. 1.0.0 doesn't call it, and 1.0.2 refuses a manifestURL that isn't http or https at admission.

World, Wasmtime and WASI versions

Serves guestfn:function@1.0.0 on Wasmtime 50.0.3: WASI 0.2.12 (cli, clocks, http, io) for the sync scaffolds and WASI 0.3.0 (cli, clocks, http) for the rust scaffold.

Merged pull requests

Full changelog: function-wasm-v1.0.2...function-wasm-v1.0.3

function-oci-v0.4.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 23 Nov 12:30
b082a58

With --warm-modules or --cosign-trust-instance set, function-oci 0.4.0 refuses requests until the pod has warmed up, where 0.3.0 served them cold. It also logs a process that the memory limit killed after it had answered. The Input, the manifest and oci@0.1 are unchanged, and an image that ran on 0.3.0 runs without a rebuild.

Before you upgrade

If you set --warm-modules or --cosign-trust-instance, give the function's pod a readiness probe on /readyz. Without one, a step that calls a pod still warming up fails with rpc error: code = Unavailable desc = the function is not ready until Crossplane retries it after warm-up has ended. The probe keeps the pod out of the Service until then (Readiness and warm-up).

For operators

A pod refuses requests until warm-up ends

On 0.3.0 the runtime ran a RunFunction call that arrived during warm-up at once, loading its module cold or joining a load already in flight. 0.4.0 answers it with UNAVAILABLE and runs nothing, as function-sdk-rust's own server does for a function that's still loading. Warm-up is the first trusted-root fetch under --cosign-trust-instance, bounded to one minute, then each --warm-modules entry, with its VM snapshot under --enable-vm-snapshots. Until it ends the gRPC health service reports NOT_SERVING for the server as a whole as well as for the function. On 0.3.0 the server's status read SERVING from the start (#422).

A process killed after its answer is logged

A process that the memory limit kills after it has answered fails no step, since the caller already has its response. On 0.3.0 the VM's serial console, which the runtime logs at debug, was the one place that kill showed. Stopping the VM could also cut short the exit line that the init writes there. 0.4.0 logs the kill as a warning with the module and its digest, process was killed after it answered: the run's memory limit of … was exceeded, and the exit the init reports after an answer as the debug record the process's exit after its answer. The init now waits until the console has sent its exit line before it reports the exit, so the console in the --debug log ends with that line whole (Install function-oci, #413).

For module authors

The runtime re-encodes the request and the response

The runtime now decodes the request and the response as function-sdk-rust 0.6.0's messages and encodes them again on the way. It keeps the fields newer than its own proto in both directions. The bytes a module receives aren't the caller's own, so a module can't depend on their layout. A response that doesn't decode now fails the step with module … failed: run returned an error: … (gRPC status Internal), and 0.3.0 printed module … failed: cannot decode response: …. The decode and the encode take time in proportion to the messages' size. That cost isn't measured on function-oci. On function-wasm, wire to wire, a request with 1000 composed resources (5.4 MB) now takes a median of 105 to 106 ms, against 59 to 69 ms before (OCI runtime, #422, #423).

Merged pull requests

  • docs: say what a patch release may change by @jonasz-lasut in #390
  • docs: tested versions of function-oci-v0.3.0 by @jonasz-lasut in #394
  • chore(deps): update rust crate prost-types to v0.14.5 by @renovate[bot] in #395
  • chore(deps): update dependency bytecodealliance/wasm-pkg-tools to v0.16.2 by @renovate[bot] in #396
  • chore(deps): update rust crate prost-types to v0.14.6 by @renovate[bot] in #397
  • chore(deps): update cgr.dev/chainguard/glibc-dynamic:latest docker digest to a5e9991 by @renovate[bot] in #398
  • chore(deps): update rust crate jiff to v0.2.44 by @renovate[bot] in #399
  • chore(deps): lock file maintenance by @renovate[bot] in #353
  • chore(deps): update embarkstudios/cargo-deny-action action to v2.1.2 by @renovate[bot] in #401
  • chore(deps): update cgr.dev/chainguard/glibc-dynamic:latest docker digest to 48ce6d7 by @renovate[bot] in #400
  • chore(deps): ignore chrono advisory in cargo-deny by @jonasz-lasut in #408
  • docs: shorten the agent guide and add CONTRIBUTING by @jonasz-lasut in #407
  • chore(renovate): gate the WASI comment bump by age by @jonasz-lasut in #410
  • ci: skip CI for Vale and Renovate config changes by @jonasz-lasut in #411
  • chore(deps): update module sigs.k8s.io/controller-runtime to v0.25.3 by @renovate[bot] in #402
  • chore(deps): correct the chrono ignore comment by @jonasz-lasut in #414
  • chore(deps): update dependency wasmtime-wasi-http to v50.0.2 by @renovate[bot] in #404
  • feat(guestfn): write the current function release by @jonasz-lasut in #415
  • fix(oci): keep the init's exit report whole by @jonasz-lasut in #413
  • chore(deps): update cgr.dev/chainguard/glibc-dynamic:latest docker digest to a49f6f6 by @renovate[bot] in #406
  • chore(deps): update rust by @renovate[bot] in #405
  • ci: lint the shell scripts and the workflows by @jonasz-lasut in #416
  • chore(deps): update actions/setup-go action to v7.1.0 by @renovate[bot] in #419
  • chore(deps): update dependency renovate to v44.253.0 by @renovate[bot] in #420
  • chore(deps): update examples by @renovate[bot] in #417
  • refactor(runtime): forward the SDK's messages by @jonasz-lasut in #422
  • refactor(engine): take the SDK's messages by @jonasz-lasut in #423
  • chore(deps): update cgr.dev/chainguard/glibc-dynamic:latest docker digest to 3359c6b by @renovate[bot] in #425
  • chore(deps): update rust to v4.15.0 by @renovate[bot] in #418
  • chore(deps): update vale by @renovate[bot] in #426
  • chore(deps): update wasmtime to v51 by @renovate[bot] in #432
  • chore(deps): update dependency renovate to v44.256.1 by @renovate[bot] in #431
  • chore(deps): update rust by @renovate[bot] in #428
  • chore(deps): update github-actions by @renovate[bot] in #429
  • docs(oci): name function-oci v0.4.0 in the example by @jonasz-lasut in #433
  • docs(wasm): name function-wasm v1.1.0 in installs by @jonasz-lasut in #434
  • fix(engine-wasm): refuse GC and function references by @jonasz-lasut in #435

Full Changelog: function-oci-v0.3.0...function-oci-v0.4.0

guestfn-v0.3.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 13 Nov 17:23
b5a7187

guestfn 0.3.0 brings the scaffolds up to function-wasm 1.0.2 and to wit-bindgen 0.63, which changes the layout of the Go scaffold's bindings. The commands and their flags are the same as in 0.2.0, and a project scaffolded with 0.2.0 keeps building as it is.

Before you upgrade

Nothing to do for an existing project. The CLI doesn't touch a project's vendored glue or bindings: they stay as the version that scaffolded them wrote them, until you regenerate them yourself.

If you pass registry references to guestfn push, guestfn inspect or guestfn manifest show, write the registry as a plain host. A reference with user information in its registry part (user:password@registry/…), a shorthand IP address such as 127.1 and a non-ASCII host name are refused, as the runtime refuses them since function-wasm 1.0.1. Credentials come from your Docker configuration, as before.

For module authors

The Go scaffold's bindings have a new layout

guestfn init --lang go writes the bindings wit-bindgen 0.63.0 generates. They are under internal/bindings/imports/ and internal/bindings/exports/, where 0.2.0 wrote every package directly under internal/bindings/, and the slot for the world's run export is at internal/bindings/exports/export_wit_world/run.go. The bindings' runtime, go.bytecodealliance.org/pkg, is at v0.4.0. The function you write, fn.go, and the internal/wasmfn API it uses are unchanged (Write a module, #374).

A project scaffolded with 0.2.0 has the old layout and keeps working. To move it, regenerate its bindings with wit-bindgen 0.63.0 and copy internal/wasmfn/host_wasip2.go from a fresh scaffold, since the generated package paths and some constant names changed.

Scaffolds reference function-wasm 1.0.2

The example/functions.yaml that guestfn init writes for crossplane render references the package ghcr.io/jonasz-lasut/function-wasm:v1.0.2, the current release, where 0.2.0 wrote v1.0.0 (#363, #379).

Newer generators behind the scaffolds

The rust scaffold depends on wit-bindgen 0.63. The python scaffold pins the protobuf runtime 7.36.2, and its codec and the ts scaffold's are the output of protoc 36.2 and protoc-gen-es 2.17.0 (#374, #375, #380).

The checks guestfn shares with the runtime

guestfn build, push, inspect and manifest validate run the runtime's own checks, so they follow function-wasm 1.0.1 and 1.0.2: a registry is read into its canonical form (lowercase, no trailing dot, no default port), a manifest fetched from a registry is read up to 4 MiB, and a download follows a redirect to another host only at a public address (#357, #359, #360).

Merged pull requests

Full changelog: guestfn-v0.2.0...guestfn-v0.3.0

function-wasm-v1.0.2

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 13 Nov 14:51

Caution

This is a security release, and every installation of 1.0.0 or 1.0.1 whose operator policy has a requireSignature rule should upgrade. An HTTP module whose URL had user information or a path that isn't normalized was loaded without the signature the policy requires. After the upgrade such a URL is refused under a policy with a requireSignature rule, and an HTTP source's manifestURL and manifestDigest are refused unless set together. Read "Before you upgrade".

function-wasm 1.0.2 closes a way around an operator's signature requirement and tightens two checks on what a request specifies. The flags, the manifest and the world are unchanged, and a module built for 1.0.0 runs without a rebuild.

Before you upgrade

Check HTTP module sources where the operator policy requires signatures. Under a policy with any requireSignature rule, a module.http.url with user information (https://user@host/…) or with ., .. or empty segments in its path is now refused:

module.http.url "https://modules.example.org/dev/../prod/fn.wasm" must have a normalized path (no . or .. segments, no empty segments): the operator policy requires cosign signatures by location (requireSignature), and this one cannot be read

Write the URL without them. Under a policy with no requireSignature rule, and with no policy file, these URLs work as before.

Check HTTP sources that specify a manifest. An Input with module.http.manifestURL and no module.http.manifestDigest, or the digest without the URL, is refused at admission with module.http.manifestURL and module.http.manifestDigest must be set together. On 1.0.1 a digest alone was ignored. Run function validate over your Compositions with the new version to find them.

Security

A signature requirement didn't hold for some HTTP URLs

The runtime asks the operator policy whether a module must be signed by the module's location. For an HTTP source the location is the URL as scheme://host/path, read only from a URL with no user information and a normalized path. Where the URL was written another way, no location was read, and the runtime took the source for one the requireSignature rules don't cover. That let a Composition author load an unsigned HTTP module from a location where the operator requires a signature. A module chosen by a composite resource through module.from wasn't affected, because such a URL is refused there.

In 1.0.2 a source whose location can't be read is held to the rules: it's required wherever the policy has a requireSignature rule, and since only OCI modules can be signed, it's refused with a sentence that says what is wrong with the URL (Signatures, #369).

Fixes

A manifest URL and its digest come together

The input reference says module.http.manifestDigest is required with module.http.manifestURL and refused without it, and nothing enforced that for a source written in the Input. Admission now refuses one without the other, a manifestURL that isn't an http or https URL and a manifestDigest that isn't sha256: followed by 64 hex characters (Input reference, #369).

An oversized gRPC timeout

A grpc-timeout header with a value past what gRPC allows overflowed the deadline calculation and failed the request in the handler. The runtime now reads such a value as no deadline, and the run is bounded by limits.timeout and --module-timeout as usual (#369).

World, Wasmtime and WASI versions

Serves guestfn:function@1.0.0 on Wasmtime 50.0.1: WASI 0.2.12 (cli, clocks, http, io) for the sync scaffolds and WASI 0.3.0 (cli, clocks, http) for the rust scaffold. Nothing here moved since 1.0.0.

Merged pull requests

Full changelog: function-wasm-v1.0.1...function-wasm-v1.0.2

function-wasm-v1.0.1

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 13 Nov 12:35

Caution

This is a security release, and every installation of 1.0.0 should upgrade. A module could keep a run going past limits.timeout and the request's deadline, a module with an egress grant could make the runtime buffer a request body of any size, and a signature verified for a module in one repository was accepted for the same digest in another. After the upgrade a module that sleeps or blocks in a WASI call spends its limits.timeout while it waits, a wasi:http request body is at most 4 MiB, and a policy that names a repository in a non-canonical spelling stops the runtime at startup. Read "Before you upgrade".

function-wasm 1.0.1 is a security release. It fixes two ways a module could use more of the runtime than its limits allow, and several ways a module reference, a policy or a download could get past a check an operator wrote. The Input, the flags, the manifest and the world are unchanged, and a module built for 1.0.0 runs without a rebuild.

Before you upgrade

Check the repository names in your policies. The runtime now reads the registry part of every OCI reference into one canonical form, and refuses a policy, the operator's or a compositionPolicy, that names a Repository in another spelling. The operator policy is checked at startup, so run function validate with the new version against your policy file first. The refusal gives the name to write:

Repository::"GHCR.IO/acme/prod" is not the canonical name of that repository; write Repository::"ghcr.io/acme/prod"

The canonical form is a lowercase host with no trailing dot and no default port, and Docker Hub is index.docker.io, as before.

Check module references that depended on a spelling. A reference with user information in its registry part (user:password@registry/…) is refused. So are a shorthand IP address such as 127.1 and a non-ASCII host name. A registry is reached over plain HTTP only when its host is exactly localhost or a loopback IP address. A host that merely starts with one, such as localhost-registry:5000, is now reached over HTTPS.

Check modules that wait on purpose. On 1.0.0 the time a module spent asleep or blocked in a WASI call didn't count against limits.timeout. On 1.0.1 it does, and the run ends with run failed: module exceeded its execution deadline (…) when the budget is spent. A module with a retry loop that sleeps between attempts may need a higher limits.timeout, up to the runtime's --module-timeout. The time a module waits for the host's HTTP answer is still credited back.

Check modules that upload. A wasi:http request with a body over 4 MiB now fails in the guest with sandbox.egress: the request body exceeds 4194304 bytes (maxRequestBytes).

Check policies with a forbid that leaves its action unconstrained, forbid (principal, action, resource) when { … };. On 1.0.0 such a rule did nothing for composeResource, requireResource and the sandbox actions of a compositionPolicy. On 1.0.1 it applies to them, so a module whose output, reads or requirements the rule matches is refused.

Check HTTP module sources behind a redirect. A redirect to another host is followed only when that host resolves to an address outside the default block list, and the runtime connects to it directly, without a proxy. For a module behind a redirect to an address inside the cluster, specify the final URL in module.http.url.

Security

A run could outlast its deadline

The runtime enforced a run's deadline by interrupting the module's code. A module suspended in a host call executes no code, so a module that slept on a WASI clock, or blocked on a pollable, ran until that call returned, whatever limits.timeout, --module-timeout and the request's deadline said. Each such run held a thread, its memory and its run slot for as long as it waited. Any module could do it, in the default sandbox with no grant, so an installation that runs modules it doesn't fully trust was exposed: enough waiting runs stall every request the runtime serves.

1.0.1 also holds a run to the wall clock. The limit is the run's budget plus the time credited for wasi:http, never past the request's deadline, and the run ends with the deadline message whether the module is executing or not (Limits, #354).

A request body was buffered without a bound

The host read a wasi:http request body whole before it asked the egress policy about the request, outside the run's memory limit. A module with an egress grant could stream a body of any size and exhaust the pod's memory, and the destination didn't have to be one its grant admits. A module without a grant couldn't, because the runtime refuses its sends first.

1.0.1 bounds the body at 4 MiB as the host reads it, the size of the response budget. It also credits back to the deadline only the time a module waits for the host's HTTP answer, once for requests that overlap. On 1.0.0 the time a module took to send its body was credited too, which let it stretch its own deadline (HTTP egress, #354).

A verified signature was remembered by digest alone

The runtime verifies a module's signature once per process and remembers the verdict. It remembered it under the manifest digest, without the repository. The trustSigner rules decide per repository, so once a digest had been verified in a repository whose signer the policy trusts, the same digest referenced from another repository loaded without a check against that repository's rules.

1.0.1 remembers a verdict per repository and digest (Signatures, #357).

A registry had more than one spelling

The policies compared a module's location as it was written. GHCR.IO/acme/x, ghcr.io:443/acme/x and ghcr.io./acme/x reach the same repository as ghcr.io/acme/x, and none of them matched a rule written for it. Where a composite resource chooses the module, its author could use such a spelling to step around a requireSignature or forbid rule. A host that only started with localhost or 127. was also contacted over plain HTTP.

1.0.1 reads the registry part into one canonical form before any policy, signature check or message uses it, refuses a reference whose registry part isn't a host, and refuses a policy that names a repository in another spelling, as "Before you upgrade" describes (The canonical registry, #357).

A forbid of any action didn't apply to the fences

A policy layer judges composeResource, requireResource and, in a compositionPolicy, the sandbox actions only where one of its rules specifies the action. A forbid with an unconstrained action specifies none, so the layer wasn't consulted and the rule never applied: forbid (principal, action, resource) when { resource == Kind::"core/Secret" }; let a module compose a Secret.

In 1.0.1 such a rule applies to those actions without scoping them. Where no other rule specifies the action, the layer refuses what the forbid matches and permits the rest (The composition layer, #360).

Downloads and registry responses

An HTTP module or manifest download followed any redirect, so a host a policy permits could point the runtime at an address inside the cluster. The runtime now follows a redirect within the URL's origin unchanged, and to another host only at an address outside the default block list (HTTP redirects, #359).

The registry client read a manifest and a token endpoint's answer whole. A manifest is now read up to 4 MiB and a token response up to 1 MiB, and a longer one is refused (#360).

Egress block list and listeners

The default egress block list gains the prefixes that embed an IPv4 address in an IPv6 one and were missing: the local-use NAT64 prefix 64:ff9b:1::/48, 6to4 2002::/16 and Teredo 2001::/32. It also gains 192.0.0.0/24 and the benchmarking range 198.18.0.0/15. An operator dialAddress rule still permits one of them where a module needs it (HTTP egress, #359).

The metrics and health listeners waited without limit for a client's request. A connection now has five seconds to send it (#359).

World, Wasmtime and WASI versions

Serves guestfn:function@1.0.0 on Wasmtime 50.0.1: WASI 0.2.12 (cli, clocks, http, io) for the sync scaffolds and WASI 0.3.0 (cli, clocks, http) for the rust scaffold. Nothing here moved since 1.0.0.

Merged pull requests

Read more

function-oci-v0.3.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 13 Nov 17:40
b5a7187

Caution

This is a security release, and every installation of 0.2.0 should upgrade. A module's process could exhaust the pod's memory with its output, an image could do the same when its layers were unpacked, and two checks on a module's signature and repository could be stepped around. After the upgrade an image may unpack to at most eight times --module-size-limit, a policy that names a repository in a non-canonical spelling stops the runtime at startup, and every stored image is unpacked again once. Read "Before you upgrade".

function-oci 0.3.0 bounds what a module and its image can take from the runtime, closes several ways around a policy, and makes a run faster: the root filesystem is packed with zstd, and a caller gets its response before the VM is torn down. The Input, the manifest and the contract an image implements are unchanged, and an image that ran on 0.2.0 runs without a rebuild.

Before you upgrade

Check the repository names in your policies. The runtime now reads the registry part of every OCI reference into one canonical form, and refuses a policy, the operator's or a compositionPolicy, that names a Repository in another spelling. The operator policy is checked at startup, so run function validate with the new version against your policy file first. The refusal gives the name to write:

Repository::"GHCR.IO/acme/prod" is not the canonical name of that repository; write Repository::"ghcr.io/acme/prod"

The canonical form is a lowercase host with no trailing dot and no default port, and Docker Hub is index.docker.io, as before.

Check image references that depended on a spelling. A reference with user information in its registry part (user:password@registry/…) is refused. So are a shorthand IP address such as 127.1 and a non-ASCII host name. A registry is reached over plain HTTP only when its host is exactly localhost or a loopback IP address.

Check large images. What an image's layers unpack to is bounded to eight times --module-size-limit and to a million entries. A larger image is refused at load with image unpacks to more than … bytes, eight times the size limit (--module-size-limit): raise the flag or build a smaller image.

Check policies with a forbid that leaves its action unconstrained, forbid (principal, action, resource) when { … };. On 0.2.0 such a rule did nothing for composeResource, requireResource and the sandbox actions of a compositionPolicy. On 0.3.0 it applies to them, so a module whose output, reads or requirements the rule matches is refused.

Expect the first run of every image to be slow once. A stored root filesystem and its VM snapshot from 0.2.0 aren't reused: each image is unpacked, packed and snapshotted again the first time it runs.

If you run your own guest kernel, it needs squashfs with zstd built in (CONFIG_SQUASHFS_ZSTD). The kernel in the package has it. Without it no VM mounts its root filesystem, and a run ends at its deadline with the guest did not connect before the deadline.

If you watch guestfn_module_run_duration_seconds, expect it about 20 ms lower. It's now observed when the caller has its response, as the metrics page describes it, and no longer includes the VM's teardown.

Security

A process's output was buffered without a bound

The host collects what a module's process writes to stdout and stderr, to log it and to quote its last line when the process fails. It kept all of it in memory for the length of the run, outside the VM's memory limit. A process that wrote continuously could exhaust the memory of the function's pod and flood its log.

0.3.0 keeps the last 256 KiB of a run's output and says in one warning how much it dropped, and cuts a logged line at 16 KiB (OCI modules, #356).

An image was unpacked without a bound

--module-size-limit bounded the compressed bytes the runtime pulled and nothing bounded what they expand to. A layer that compresses very well, or a tar header stating a very large entry, ended the pod when the image was loaded, before any run-time limit applies.

0.3.0 bounds what the layers unpack to, as "Before you upgrade" describes, and reserves nothing from a header's stated size. It also unpacks layers as a container runtime does: whiteouts apply to the lower layers alone, an entry under a symbolic link to a directory goes where the link leads inside the image, and an entry with a .. segment, one under a file, and a hard link to a file that isn't in the image are refused (Troubleshooting, #358).

A verified signature was remembered by digest alone

The runtime verifies an image's signature once per process and remembers the verdict. It remembered it under the manifest digest, without the repository. The trustSigner rules decide per repository, so once a digest had been verified in a repository whose signer the policy trusts, the same digest referenced from another repository loaded without a check against that repository's rules.

0.3.0 remembers a verdict per repository and digest (Signatures, #357).

A registry had more than one spelling

The policies compared an image's location as it was written. GHCR.IO/acme/x, ghcr.io:443/acme/x and ghcr.io./acme/x reach the same repository as ghcr.io/acme/x, and none of them matched a rule written for it, so a Composition author could step around a requireSignature or forbid rule with such a spelling.

0.3.0 reads the registry part into one canonical form before any policy, signature check or message uses it, refuses a reference whose registry part isn't a host, and refuses a policy that names a repository in another spelling (The canonical registry, #357).

A forbid of any action didn't apply to the fences

A policy layer judges composeResource, requireResource and, in a compositionPolicy, the sandbox actions only where one of its rules specifies the action. A forbid with an unconstrained action specifies none, so the layer wasn't consulted and the rule never applied. In 0.3.0 such a rule applies to those actions without scoping them: where no other rule specifies the action, the layer refuses what the forbid matches and permits the rest (The composition layer, #360).

Smaller hardening

  • A registry's manifest is read up to 4 MiB and a token endpoint's answer up to 1 MiB (#360).
  • The metrics and health listeners give a connection five seconds to send its request (#359).
  • The VM's root filesystem, its overlay and /tmp are mounted nodev and nosuid (#362).

For operators

A run is faster

The runtime packs an image's root filesystem with zstd instead of gzip. The guest reads it faster on every run, cold or restored from a snapshot, and the stored image is the same size. For the Go example, a 37 MiB image, a cold run went from 552 to 436 ms and a restored run from 448 to 321 ms, measured on a GitHub-hosted runner under nested KVM. Packing an image at its first load is faster too, 173 ms against 1,450 ms (#382).

A caller also gets its response as soon as the function has answered. The runtime used to stop the VM first, which took about 20 ms. The VM is now stopped in the background, and the run's slot and its memory reservation stay held until it's gone, so --max-concurrent-runs and the memory pool bound what they did. A step's own limits.concurrency ends with the call, so a step can for a moment have one more VM being stopped (#382).

A loaded image's root filesystem survives the disk sweep

With --max-cache-size set, the sweep could remove the stored root filesystem of an image still loaded in memory, and every later run of that image failed until it left memory. The runtime now holds the file while the image is loaded, and the sweep skips it. The stores can therefore stay over the bound while the loaded images alone exceed it (Runtime flags, #362).

A multi-platform image keeps loading

An image referenced by its index, as a multi-platform image is, could be refused with … is an image index; reference the manifest holding the module once the runtime had loaded a few thousand modules and the image was still cached. The runtime now reads the platform's manifest in that case as it does on a first load (#384).

Other fixes

  • A failed VM snapshot removes its unfinished files, which the sweep didn't see (#362).
  • A limits.memory or limits.timeout with a fraction too long to compute is refused as not valid, where it wrapped to a wrong value (#384).
  • A new compositionPolicy no longer delays the requests that carry another policy while it's compiled (#384).
  • A grpc-timeout too large to state as a deadline is read as none (#369).

The package is signed in the ru...

Read more

guestfn-v0.2.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 12 Nov 21:30
cdf3a65

guestfn 0.2.0 is a small release for function-wasm 1.0.0: the Rust scaffold builds on stable Rust, and every scaffold's example references the 1.0.0 package. The commands, their flags and the modules they build are the same as in 0.1.0, and a project scaffolded with 0.1.0 doesn't need any change.

For module authors

The Rust scaffold builds on stable Rust

Rust 1.100.0 made wasm32-wasip3 a stable target. The rust-toolchain.toml that guestfn init --lang rust writes named a beta pinned by date, channel = "beta-2026-10-05", and now has channel = "stable". The file is still there, with the target and the rustfmt and clippy components, and rustup adds them the first time Cargo runs in the project. A stable toolchain older than 1.100.0 needs rustup update stable first. A project scaffolded with 0.1.0 keeps building on its pinned beta. To move it, set channel = "stable" in its rust-toolchain.toml (Other languages, #339).

Scaffolds reference function-wasm 1.0.0

The example/functions.yaml that guestfn init writes for crossplane render referenced the package ghcr.io/jonasz-lasut/function-wasm:v0.1.0. It now references v1.0.0, the first function-wasm release that reads the contract: wasm@1.0 manifests this CLI writes (#344).

Merged pull requests

Full changelog: guestfn-v0.1.0...guestfn-v0.2.0

function-wasm-v1.0.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 12 Nov 21:30
d76369b

function-wasm 1.0.0 is the first stable release: from here, everything Compatibility lists changes only through its deprecation policy. It's also a breaking release from 0.6.0. ABI v1 core modules no longer run, the Input's group and the project's names changed with no alias, and a step's config now names a field of the composite resource. Every module and every Composition needs the changes below. The sandbox hasn't had an independent security review.

Before you upgrade

A module published for 1.0.0 declares contract: wasm@1.0, which 0.6.0 doesn't read, so the Function and the Compositions that name the new module digests change together. Run function validate from the 1.0.0 image over your Compositions first: it prints the Input refusals below without a cluster, and with --resolve the module refusals too (Check a composition).

Rebuild every ABI v1 module as an ABI v2 component. 0.6.0 ran a core module with a deprecation warning, and 1.0.0 refuses it at load (#149):

cannot load module …: module is a core module, which function-wasm 1.0.0 no longer runs (ABI v1 was removed); build it as an ABI v2 component (docs/abi-v2.md)

For a Go guest, guestfn build turns the core module go build emits into a component. A guest written against ABI v1 moves onto a current scaffold: run guestfn init, then copy the function over.

Move every module project to the current guestfn and publish it again. Rename wasmfn.yaml to guestfn.yaml, replace abi: 2 with contract: wasm@1.0 and delete minRuntime if the file sets it. guestfn build refuses an old field by name, such as unknown field "abi". Make wit/world.wit include guestfn:function/function@1.0.0, or guestfn:function/function-sync@1.0.0 if the toolchain can't async-lift run, add wit/deps/ to .gitignore and run guestfn wit update. Then run guestfn build and guestfn push, and put the new digest in the Composition. A module that was already a component needs the push too. The manifest layer's media type changed from application/vnd.wasmfn.manifest.v1+json to application/vnd.guestfn.manifest.v1+json, and 1.0.0 doesn't read the old one: a module pushed by an earlier guestfn loads without its manifest and is granted nothing it requires (#244, #251, #302, #317).

Change the apiVersion of every Input to guestfn.crossplane.io/v1. The fields are the same. The group is the one function-wasm and function-oci both read, and the runtime refuses the old group, v1 and v1beta1 alike, on every request (#246):

apiVersion wasm.fn.crossplane.io/v1 is no longer served; write apiVersion: guestfn.crossplane.io/v1 (the same fields)

Move each step's configuration into the composite resource. On 0.6.0 the Composition author wrote the value under the Input's config. On 1.0.0 config is an object of from and allowEmpty, and the runtime refuses a value written there by its first key (#268):

config.greeting is not a field of config, which has from and allowEmpty only: the module's configuration is written in the composite resource, in the field config.from names

Declare the field in the composite resource definition, write the values in the composite resource and set config: {from: spec.config} on the step. config.allowEmpty: true runs the module unconfigured when the field is unset (Input reference).

Rename --max-module-size to --module-size-limit in the DeploymentRuntimeConfig. The old flag has no alias, and the runtime exits at startup when it's given. --module-size-limit, --module-timeout, --module-memory-limit and --ttl also read an environment variable now: MODULE_SIZE_LIMIT, MODULE_TIMEOUT, MODULE_MEMORY_LIMIT and TTL (#327).

Move the cache mount from /tmp/function-wasm-cache to /tmp/guestfn-cache, and give each pod a volume of its own. 0.6.0 documented a volume shared between pods as safe. On 1.0.0 each process refuses the compiled artifacts another process wrote, and pods on one volume overwrite each other's (#267, #214, Cache storage).

Rename the metric series in dashboards and alerts: function_wasm_* is guestfn_*, with the same labels. function_wasm_module_loads_total went with ABI v1. The grpc_server_* series keep their names (#267, Metrics).

Pin any published example again. The artifacts under ghcr.io/jonasz-lasut/wasmfn/examples/<name> no longer exist. The examples are now ghcr.io/jonasz-lasut/guestfn/examples/wasm-go, wasm-rust and wasm-ts, signed keyless by https://github.com/jonasz-lasut/guestfn/.github/workflows/publish-examples.yml@refs/heads/main (#248, #274).

Quote YAML values that must remain strings. The runtime, function validate and guestfn now read YAML with a YAML 1.2 parser: unquoted yes, no, on and off are booleans, 0755 and 1_000 are numbers, a merge key merges and .inf is refused. A parse failure reads cannot parse <file>: line 3 column 11: unclosed bracket '[' (#217).

For operators

Keyless cosign signatures

0.6.0 verified key-based cosign 3 signatures only, and a module signed keyless counted as unsigned. 1.0.0 verifies a keyless Sigstore bundle against a trusted root. --cosign-trusted-root <trusted_root.json> reads the root from a file, the air-gapped mode. --cosign-trust-instance public-good|staging|github fetches it over TUF and refreshes it every --cosign-tuf-refresh (default 1h). You can't set both. A trusted root alone admits nothing: the operator policy needs a trustSigner rule that permits the certificate's issuer and identity for the module's repository, default-deny. The runtime refuses any other signer:

keyless signature by <identity> (issuer <issuer>) is not trusted for <repository>: no trustSigner rule in the operator policy permits it

If no root can be fetched or read from the cache at startup, the runtime serves anyway and refuses keyless signatures until a retry succeeds. guestfn_trusted_root_refreshes_total and guestfn_trusted_root_last_refresh_timestamp_seconds report the refresh. The refusal for a required signature the runtime can't verify now names both verifiers: the operator policy requires a cosign signature, but the runtime has neither --cosign-key nor --cosign-trusted-root to verify it (Signatures, #179, #192).

composeResource fences a module's output

On 0.6.0 nothing judged a module's output. A new Cedar action, composeResource, lets the Input's compositionPolicy and the operator's --sandbox-policy-file restrict which kinds a module may add, change or remove, the composite resource's own desired state included. After the run the runtime compares the response's desired state with the request's and judges every change. A refused change is a fatal result, and the runtime applies none of the module's output:

module oci …: composed apps/Deployment "deployment" (modify), which the compositionPolicy does not permit (composeResource)

A layer with no rule for the action narrows nothing. An existing policy behaves as before (Cedar policy reference, #195).

requireResource fences a module's reads

Through the response's requirements a module can ask Crossplane for any resource the Function's RBAC lets Crossplane read, and 0.6.0 relayed every ask. The requireResource action judges each selector by kind, name or labels, and namespace, in both policy layers, again only where a layer has a rule for it. The runtime doesn't relay a refused ask:

module oci …: required core/Secret "db-password" in namespace "team-b" (requirements.resources["db"]), which the compositionPolicy does not permit (requireResource)

The security audit done for 1.0 asked for this fence (the read fence, #233).

Compiled artifacts are valid for one process

Wasmtime loads a compiled artifact as native code with no check of its own, so 0.6.0 would have run a file planted in the compiled cache by someone with write access to the directory. Each process now signs the artifacts it writes with an HMAC under a key it draws at startup, and refuses any other. There's no flag and no mounted key: a key behind a flag was rejected as one more thing for every operator to configure. A restarted pod now compiles every module again, with or without a volume. A volume still saves the fetch, and --warm-modules moves the compile ahead of readiness ([Trust model](https://jonasz-lasut.github.io/guestfn/operators/trust-model.htm...

Read more

function-oci-v0.2.0

Choose a tag to compare

@jonasz-lasut jonasz-lasut released this 12 Nov 20:17
bff4847

function-oci 0.2.0 runs an image's process as a non-root user with no Linux capabilities, and refuses an image that would run it as root. An image built without a USER line worked on 0.1.0 and doesn't load on 0.2.0, so check your images before you upgrade. function-oci is still 0.x: a release may break what the one before it accepted.

Before you upgrade

Give every image a non-root user. The runtime refuses an image whose config sets no user, sets the number 0, or names a user that the image's /etc/passwd gives UID 0. The step fails with a fatal result:

cannot load module …: image runs as root (its config sets no user): the OCI runtime runs a process as a non-root user only (docs/oci/modules.md)

Add a numeric user to the Dockerfile, for example USER 65532:65532, which needs no /etc/passwd in the image. Rebuild and push the image, run guestfn push --image again, and put the new digest in the Composition.

Check anything the process did that needed privilege. A setuid binary or a file capability in the image no longer raises what the process may do, the process can't bind a port below 1024, and it writes only where its user may: /tmp, and the paths the image gives that user.

For operators

Images that run as root are refused at load

On 0.1.0 the process ran as whatever user the image named, root included. On 0.2.0 the runtime refuses such an image when it loads the module, before a VM boots. For an image that sets no user or the number 0 it decides from the image config alone, before it unpacks a layer, and function validate --resolve prints the same verdict. A user given by name is resolved against the image's /etc/passwd first. There is no flag to turn the check off. Troubleshooting has the refusal (#333).

For module authors

The process has no capabilities

Before it starts the process, the init in the VM empties the capability bounding set, clears the permitted, effective, inheritable and ambient sets, and sets no_new_privs. Root in the guest is then the init alone, so the process can't change the memory limit of its own run or interfere with the init. This is also what the egress proxy planned in #280 depends on. The function's gRPC server on port 9443 is unaffected. OCI modules describes what the process sees (#333).

Merged pull requests

Full changelog: function-oci-v0.1.0...function-oci-v0.2.0