Repository navigation
Description
Title: Envoy WASM extensions in the present and its future (Proxy-Wasm)
Description:
Envoy current supports WASM extensions via the WASM filter. I am aware of the following warning:
The Wasm filter is experimental and is currently under active development. Capabilities will be expanded over time and the configuration structures are likely to change.
The documentation for the feature is fairly terse and I largely used articles like https://tetrate.io/blog/wasm-modules-and-envoy-extensibility-explained-part-1/ and there was Google Document proposal that I had read a while back but I'm now unable to find the document. We have hit a number of issues in terms of the documentation, extension development process and clear understanding of the adhered ABI spec and plans for that.
- The ABI that Envoy seems to have chosen is https://github.com/proxy-wasm. But if you look at the spec as it is defined today under https://github.com/proxy-wasm/spec/tree/main/abi-versions it is in-fact empty at this time. Envoy appears to use
v0.1.0of the spec, although that isn't clear documented. Spec documentation for v0.1.0? proxy-wasm/spec#46 is a request for information on the spec and where it might be defined. Document Proxy-Wasm ABI v0.2.1. proxy-wasm/spec#42 appears to attempt to documentv0.2.1of the spec but it is coming up on a year without that being merged. - The organization https://github.com/orgs/proxy-wasm/people only has one member (https://github.com/lizan) at this time. It does appear that the organization and hence the spec has been abandoned at this time.
- https://github.com/tetratelabs/proxy-wasm-go-sdk was what I used to get it all working. This is maintained outside the aforementioned organization and with https://github.com/tetratelabs. It also references the ABI spec for https://github.com/proxy-wasm which we have established isn't up-to-date or really documented.
- Kong even seems to have adopted Proxy-Wasm as they have https://github.com/Kong/ngx_wasm_module/. They actually had some good examples of writing filters which could largely be used with Envoy. Also see https://konghq.com/blog/engineering/proxy-wasm.
- Even Istio has a similar documentation for using WASM under https://istio.io/latest/docs/concepts/wasm/ but has the same documentation issues as Envoy but does refer to a decent set of examples under https://github.com/istio-ecosystem/wasm-extensions. There are lots of articles from the Istio community with announcements like https://opensource.googleblog.com/2020/03/webassembly-brings-extensibility-to.html and https://www.solo.io/blog/an-extended-and-improved-webassembly-hub-to-helps-bring-the-power-of-webassembly-to-envoy-and-istio/. Unfortunately, I get blocked from using their announced https://webassemblyhub.io/ and I'm not even sure if it is alive and used today.
- I noticed that Envoy Gateway 1.0 was announced (https://gateway.envoyproxy.io/news/blogs/1.0-release/1.0-release/). WASM extensions are part of its release and the documentation exists at https://gateway.envoyproxy.io/docs/tasks/extensibility/wasm/ but once again it really doesn't cover how to build an extension and doesn't even mention Proxy-Wasm.
There are many more references across the Internet with reference to WASM extensions for things that use Envoy under the hood or have decided to also adopt it as its ABI. But as I mentioned above the spec isn't really even defined in the public space and all work on it appears abandoned or stalled.
What I'm trying to determine is the following:
- Does Envoy in-fact use Proxy-Wasm and
v0.1.0of the spec? - Since the spec doesn't exist in consumable form under https://github.com/proxy-wasm/spec/tree/main/abi-versions how can I determine the ABI that Envoy is using?
- Does Envoy intend to move to later versions of the spec, assuming they are documented and agreed upon at some point in the future?
- When products like https://gateway.envoyproxy.io refer to WASM extensibility I assume they are using Envoy under the hood and that in fact Envoy's WASM extensions are used. Is this a correct assumption?
- Does anyone have a good understanding of the future of WASM extensions in Envoy and what the support and evolution might look like?
Relevant Links:
- proposal: design Wasm ABI for tracing providers #10563
- https://github.com/proxy-wasm
- https://github.com/proxy-wasm/spec
- https://github.com/tetratelabs/proxy-wasm-go-sdk
- https://istio.io/latest/docs/concepts/wasm/
- https://github.com/istio-ecosystem/wasm-extensions
- https://webassemblyhub.io/
- https://gateway.envoyproxy.io/docs/tasks/extensibility/wasm/
Activity
phlax commentedon Jul 24, 2024
@marc-barry i would be happy to review any improvements to the docs - sounds like we have some gaps in current docs
cc @mpwarres wrt substantive questions
marc-barry commentedon Jul 24, 2024
@phlax thanks for answering. I also don't mind helping improve this in the community and contributing. Perhaps we can start with documenting the ABI interface details that Envoy uses so that developers can reference this when developing extensions. I couldn't find any examples for Envoy and perhaps I could contribute a simple example that we could include.
https://www.envoyproxy.io/docs/envoy/v1.31.0/api-v3/extensions/wasm/v3/wasm.proto#envoy-v3-api-msg-extensions-wasm-v3-pluginconfig is documented quite well but the gap is, for example, from say Go code to a WASM plugin that can be loaded. If you navigate down to
allowed_capabilitiesyou'll see a reference toThe capability names are given in the [Proxy-Wasm ABI](https://github.com/proxy-wasm/spec/tree/master/abi-versions/vNEXT).but if you follow that link it no longer exists. I think we could focus on cleaning this up which would make it more clear. We should probably figure out how to improve the https://github.com/proxy-wasm contribution situation as this is then something that the Envoy docs could just reference.phlax commentedon Jul 24, 2024
yeah, makes sense
we have this example https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/wasm-cc, i tried previously to add something similar for rust but didnt get too far
@lizan is not as active as before but might have ideas about who to speak to - i know there is quite a bit of commitment on the google side to develop/maintain the wasm filter
mathetake commentedon Jul 26, 2024
@mpwarres @martijneken are the current owners of Proxy-Wasm and Envoy codebase, so I am truly hoping they share what direction this goes and how the evolution looks like - as a former maintainer there, I wanted to express my sorry here for the mess and I actually failed to bring it to the healthy state. I completely share the frustration that I sense you have. I hope the folks mentioned ^^ clarify their stance and how this will be resolved, especially Google's point of view on this matter. cc @alyssawilk
mathetake commentedon Jul 26, 2024
I think one idea is to eliminate the Proxy-Wasm organization dependency completely, and make the Envoy codebase self-contained. After that, host the spec and complete user-level documentation here in envoyproxy.io. Plus, host the SDKs here as well (we are more than happy donating the Go SDK). Given that there was no inter-proxy collaboration per-se since the release, there's absolutely zero benefit to Envoy in having the spec separated from Envoy at this point. pure technical debt is from my view the consensus from the conversation with other community members in the last few weeks. That's my take. That's just a random idea, but having the central place to look at is as a user myself is less confusing as well as better IMHO.
mathetake commentedon Jul 26, 2024
^^ if this sounds good to other maintainers, I am more than happy to help and maintain again - I really feel the obligation to fix this once and for all
kyessenov commentedon Jul 26, 2024
I am happy to review any doc improvements since I'm familiar with the extensions as well. A lot of the base code is used in production, for real products, so there's definitely a valid use case, but it is difficult to figure out where the stability ends and the rough edges start without looking at the code. The larger problem is that it is simply hard to start writing Wasm no matter which language one chooses (not everything will learn Rust for changing headers), so there's a barrier of entry that the improved docs may not fully address.
I think the current Wasm implementation is no longer experimental and reached some stability (for core parts), but it also failed to reach 1.0. It doesn't really matter what the version number says, since in practice, there's just one ABI used by various Proxy-Wasm efforts.
mathetake commentedon Jul 26, 2024
yeah I completely agree with @kyessenov, and in order to improve the situation (not saying I am sure how the end stability means here), I think as @marc-barry hinted (and I believe everyone is aware), the unnecessary dependency on the Proxy-Wasm org makes the situation worse or standstill. What I am suggesting is to document and host everything in envoyproxy.io so there is just one single source of truth. This is not only about the documentation, but also how the ecosystem around it works like who's responsible for what, how's the issue handled, where's the place to report issues, what's the support policy etc. Currently all of them is a mess. But open to suggestions, and curious how others think about the coupling with Proxy-Wasm and leaving everything there as-is benefits Envoy just by looking at the history
thenewwazoo commentedon Jul 26, 2024
I'm an onlooker, but thought I might weigh in. My employer is interested in leveraging existing logic written in Rust (or in porting Java code to Rust) in order to embed it in multiple places, one of which is Envoy filters. We benchmarked C++, Lua, and Rust WASM (using the v8 runtime) and found the overhead of WASM to be a show-stopper. I have been experimenting for the last ~week with building NullVM filters to compile into v1.30 but ran into this problem after some significant struggles bringing everything up-to-date, and have stopped trying.
I'm not opposed per se to proxy-wasm, but I'm doubtful as to its value given that adoption has been very poor over the last ~4 years since it was introduced. The overhead of a "real" WASM runtime is too high for us, and NullVM has (as far as I can tell) never quite been finished (and its overhead is still to be measured). As such, I'll be exploring the recent work on loadable modules. IMO that's where development effort should be directed.
kyessenov commentedon Jul 27, 2024
@thenewwazoo The criticism is shared but it's an ecosystem problem with Wasm, and not something Envoy can fix. IMO, a stable ABI is all that matters, and Wasm in Envoy has kept the stability promise despite many internal changes inside Envoy. This is no worse than other extension points, e.g. Lua, and it's more flexible since you can also use dynload "nullVM" and not be blocked by runtime performance.
55 remaining items
wbpcode commentedon Oct 9, 2024
Theoretically, based that on get/set property + foreign functions could do almost everything and needn't to change the ABI function's signatures.
But the key isn't only the signatures, is the feature set that be exposed to end developers.
When we forked and hacked the SDK+ host (Envoy) to provide some specific features, then the intermediate bridge (proxy-wasm host lib) and ABI cannot represent the actual feature set, the compatibility actually has been broken.
PiotrSikora commentedon Oct 9, 2024
That's awesome!
But you need a new ABI version for that, otherwise you'll have new plugins returning
StopIterationthat are deployed on older versions of Envoy/Istio/X, where they behave differently than expected.Right, but you can easily add first-class wrappers to the SDKs for those, so that end-users won't be able to tell whether it's standardized ABI call or a foreign functions, and once the interface is proven, then it can be included in the next ABI version.
Fast iteration and prototyping is exactly what this interface was designed for, and it doesn't require forking anything.
PiotrSikora commentedon Oct 9, 2024
This is already supported as a custom
set_envoy_filter_statehostcall.Is this also used in presence of filter state? I thought only one of those was supposed to be used going forward? See: #4929
This indeed is Envoy-specific, but we already have a dedicated issue for it: proxy-wasm/proxy-wasm-cpp-host#421
Do you mean selection of the upstream server/cluster or something else?
Do you mean per-route plugin configuration? Isn't this supported in Envoy by composite filter? In any case, Proxy-Wasm already supports running many instances of the same plugin with different configurations inside the WasmVM, so this seems more of a host implementation issue.
wbpcode commentedon Oct 9, 2024
Yeah. But we still need to wrap it to avoid exposing it to end developers in the origin way.
AFAIK, some auth filters will prefer the dynamic metadata to store json-like data.
I mean allow the filter to change the upstream cluster by rewrite the route.
Yeah.
The composite actually make things more complex and hard to use for users.
Considering the overhead of a WasmVM, it's hard to same to run lots of different vm instances is good solution.
But anyway, yeah, maybe we also need to rethinking this problem at host. Lots of problems is hard to resolve by single side.
wbpcode commentedon Oct 9, 2024
I didn't get it. I think the SDK maintained by the proxy-wasm also should be proxy-independent? Or it just make the end developers be confused. They used the SDKs, and develop an extension at their platform, then find lots of interface actually cannot work?
botengyao commentedon Oct 15, 2024
@johnlanni, off the wasm topic, and noticed Alibaba Higress is using Envoy, which is great! Does Alibaba plan to be on the security distributor list to receive and report early CVE notifications under embargo?
johnlanni commentedon Oct 16, 2024
@botengyao Absolutely, and it appears we meet the requirements to join the distributor list. I have already sent an email.
PiotrSikora commentedon Oct 16, 2024
Agreed, but when we were adding Wasm to Envoy, we were told not to handle this ourselves, and instead use the (still under development at the time) composite filters, which were supposed to address this problem for all Envoy extensions.
In any case, this should be already solved in Proxy-Wasm (but perhaps it needs to be glued together with the per-route configuration in Envoy), since you can have multiple plugin instances with different configurations, so route configuration A and route configuration B can be instantiated as plugin with configuration A and plugin with configuration B... unless I'm missing something?
Proxy-Wasm already supports running multiple instances of the same plugin with different configurations inside the same WasmVM (i.e. many-to-one), so there is no extra overhead here.
This is how the configuration reloads are handled in Envoy, and how the same plugin is used with different configurations in different filter chains (assuming the same
vm_id).Yes and no. I want to be as conservative as possible, but at the same time we should prevent unnecessary fragmentation of the Proxy-Wasm ecosystem and avoid splitting the already limited engineering resources.
Based on the discussion in this thread, if we ignore the generic features that will be added in the upcoming ABI update (e.g. complete request buffering) and things that should be handled in Envoy (route cache control and per-route configuration), then it seems that there are very few Envoy-specific features (filter state & dynamic metadata).
As such, it's probably more productive to add clearly named wrappers to the existing SDKs for those 2 or 4 (for both getters and setters) custom hostcalls, than to fork away, which might prevent plugins written using those alternative SDKs from running on non-Envoy Proxy-Wasm hosts, even when they don't require any Envoy-specific features.
github-actions commentedon Nov 15, 2024
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
markmsmith commentedon Sep 25, 2026
I see this issue is still open but has been pretty quiet since 2024, so I had a few questions on the current landscape as of 2026:
wasi:http/serviceorwasi:http/middlewareworlds? Components might make it easier to surface multiple interfaces to bind to, like wasm-proxy vs wasi:http/service vs something with envoy-specific extensions.wasi:filesystemworld could help with Expose files to wasm extensions #22557My use case here is really just to read in a small lookup table that a filter can check headers against, while being able to update the table without restarting the proxy.
leonm1 commentedon Sep 26, 2026
Hey Mark, thanks for surfacing this issue to the top of my inbox. There's been a lot of work over at https://github.com/proxy-wasm/spec over the past couple months as we move towards a new version, and we've been holding spec meetings weekly to discuss the next ABI revision and community meetings monthly where attendees can bring up anything related to proxy-wasm (https://github.com/proxy-wasm/community). We're only a couple PRs away from finalizing the specification for proxy-wasm v0.3, and I'll be working on the host+sdk implementations in short order.
Since the last post on this issue, I've also been working with the https://github.com/golang/go compiler owners to get native support for compiling wasi reactors in the full go toolchain, and we've launched https://github.com/proxy-wasm/proxy-wasm-go-sdk to use the go compiler to write wasm modules. At Google, it's been the most used SDK by Service Extensions customers since its introduction.
I'll more directly address your comments in-line:
Envoy's wasm filter (and nginx, and ATS, and MOSN, and OpenResty) currently support Proxy-Wasm and most integrations use github.com/proxy-wasm/proxy-wasm-cpp-host for the bindings to the wasm runtime. The Proxy-Wasm project is holding off on converging with WASI until WASI reaches 1.0 at the earliest. We're eagerly watching the development of WASI, but most compilers still only support wasip1, and the WIT tooling does not yet match the usability of proxy-wasm's hand-rolled SDKs (though I look forward to the day it does!).
Once WASI reaches 1.0, I think our goal is that proxy-wasm-cpp-host can instantiate both proxy-wasm and
wasi:http/middleware, and embedders don't need to explicitly build out support for WASI components. There are no official plans yet for when or how this will happen.I'd like to address your use-case first: based on the problem description, I think the best way to accomplish this today is with a timer that performs an http callout to fetch this lookup table, then parses it and publishes the values of your table via the shared data API to make the fetched data available to all instances of the plugin.
If the contents must be backed by a file, I think you could create a route with a
direct_responseto back the http callout that would serve the file in question.As for file I/O itself, proxy-wasm-cpp-host currently exposes stub implementations for all wasip1 file I/O calls, but blocks all file I/O except writes to stdout/stderr. This primarily comes down to security and a lack of a design for handling sandboxing.
I'm not opposed to PRs that implement wasip1 file I/O hostcalls with real implementations, but I'd definitely want the file access to be configurable by the embedder (and the end user running the proxy) rather than making the decision on how to sandbox in proxy-wasm.
I hope it's not crazy, as I'm working on this right now :D
I need to remove the large symbol rename patch we currently apply to wasmtime and expose the version built by the crates_universe to Envoy so that embedders can more easily bump the wasmtime version in response to vulnerability reports.
markmsmith commentedon Sep 28, 2026
Thanks for such a detailed reply, it's awesome to hear there's still a lot of momentum around supporting wasm! I'll check out proxy-wasm-go-sdk.
I know there's a proposal to have golang support WASI p3 and the new async stuff, so hopefully your efforts for wasi reactors can help with that too.