Skip to content

Envoy WASM extensions in the present and its future (Proxy-Wasm) #35420

Open

Description

@marc-barry

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.

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:

Relevant Links:

Activity

  1. added
    triage
    on Jul 24, 2024
  2. phlax commented on Jul 24, 2024

    @phlax
    Member

    @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

  3. added
    question
    and removed
    triage
    on Jul 24, 2024
  4. marc-barry commented on Jul 24, 2024

    @marc-barry
    ContributorAuthor

    @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_capabilities you'll see a reference to The 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.

  5. phlax commented on Jul 24, 2024

    @phlax
    Member

    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

  6. mathetake commented on Jul 26, 2024

    @mathetake
    Member

    @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

  7. mathetake commented on Jul 26, 2024

    @mathetake
    Member

    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.

  8. mathetake commented on Jul 26, 2024

    @mathetake
    Member

    ^^ 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

  9. kyessenov commented on Jul 26, 2024

    @kyessenov
    Contributor

    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.

  10. mathetake commented on Jul 26, 2024

    @mathetake
    Member

    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

  11. thenewwazoo commented on Jul 26, 2024

    @thenewwazoo

    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.

  12. kyessenov commented on Jul 27, 2024

    @kyessenov
    Contributor

    @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.

  13. 55 remaining items

  14. wbpcode commented on Oct 9, 2024

    @wbpcode
    Member

    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.

  15. PiotrSikora commented on Oct 9, 2024

    @PiotrSikora
    Contributor

    Yes, the Higress community has 40+ wasm plugins,

    That's awesome!

    I personally think support the stop iteration and create a beginer-friendly wrapper in the SDK would the better way to do this.

    But you need a new ABI version for that, otherwise you'll have new plugins returning StopIteration that are deployed on older versions of Envoy/Istio/X, where they behave differently than expected.

    I know we can call it with proxy_call_foreign_function.

    But I am not sure it's a good choice to let the end developers to call CallForeignFunction and handle the parameters' serialization. For example:

    CallForeignFunction("set_envoy_filter_state", <serialized_proto>);
    

    This just sacrify the experience of the end extension developers.

    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.

  16. PiotrSikora commented on Oct 9, 2024

    @PiotrSikora
    Contributor

    filter state

    This is already supported as a custom set_envoy_filter_state hostcall.

    dynamic metadata

    Is this also used in presence of filter state? I thought only one of those was supposed to be used going forward? See: #4929

    same route cache control with Envoy

    This indeed is Envoy-specific, but we already have a dedicated issue for it: proxy-wasm/proxy-wasm-cpp-host#421

    modification of route

    Do you mean selection of the upstream server/cluster or something else?

    route specific configuration

    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.

  17. wbpcode commented on Oct 9, 2024

    @wbpcode
    Member

    This is already supported as a custom set_envoy_filter_state hostcall.

    Yeah. But we still need to wrap it to avoid exposing it to end developers in the origin way.

    Is this also used in presence of filter state? I thought only one of those was supposed to be used going forward? See: #4929

    AFAIK, some auth filters will prefer the dynamic metadata to store json-like data.

    Do you mean selection of the upstream server/cluster or something else?

    I mean allow the filter to change the upstream cluster by rewrite the route.

    Do you mean per-route plugin configuration?

    Yeah.

    Isn't this supported in Envoy by composite filter?

    The composite actually make things more complex and hard to use for users.

    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.

    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.

  18. wbpcode commented on Oct 9, 2024

    @wbpcode
    Member

    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.

    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?

  19. botengyao commented on Oct 15, 2024

    @botengyao
    Member

    Yes, the Higress community has 40+ wasm plugins, most of which are compatible with official Envoy, but over 10 are not due to the use of the StopIteration feature (like the AI Proxy plugin). Having these plugins locked to Higress is not our intention; Higress's focus is on extending Envoy based on Wasm, and we hope for more non-Higress Envoy vendors to join in building these plugins.

    @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?

  20. johnlanni commented on Oct 16, 2024

    @johnlanni
    Contributor

    @botengyao Absolutely, and it appears we meet the requirements to join the distributor list. I have already sent an email.

  21. PiotrSikora commented on Oct 16, 2024

    @PiotrSikora
    Contributor

    The composite actually make things more complex and hard to use for users.

    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?

    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.

    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).

    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?

    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.

  22. github-actions commented on Nov 15, 2024

    @github-actions

    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.

  23. added
    stale
    on Nov 15, 2024
  24. added
    no stalebot
    and removed
    stale
    on Nov 15, 2024
  25. markmsmith commented on Sep 25, 2026

    @markmsmith

    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:

    1. Are there any changes to the planned Wasm and WASI support within Envoy, now that WASI preview 3 has be ratified?
    2. Are there plans to support the Component Model and the new wasi:http/service or wasi:http/middleware worlds? 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.
    3. More tactically, are there plans to surface scoped file IO (maybe just read-only) to allow reading config from a hot-reloaded file (such as a K8s ConfigMap volume) from within a wasm filter? Having support for the wasi:filesystem world could help with Expose files to wasm extensions #22557
      My 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.
    4. Would it be crazy to make Wasmtime the default the envoy wasm-runtime, since it seems to be tracking the WASI standard pretty closely? I'm guessing there's good reasons for the current default, and this is just a dumb question, but I thought I'd ask so I can understand the reasons.
  26. leonm1 commented on Sep 26, 2026

    @leonm1
    Contributor

    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:

    1. Are there any changes to the planned Wasm and WASI support within Envoy, now that WASI preview 3 has be ratified?

    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!).

    1. Are there plans to support the Component Model and the new wasi:http/service or wasi:http/middleware worlds? 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.

    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.

    1. More tactically, are there plans to surface scoped file IO (maybe just read-only) to allow reading config from a hot-reloaded file (such as a K8s ConfigMap volume) from within a wasm filter? Having support for the wasi:filesystem world could help with Expose files to wasm extensions #22557
      My 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.

    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_response to 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.

    1. Would it be crazy to make Wasmtime the default the envoy wasm-runtime, since it seems to be tracking the WASI standard pretty closely? I'm guessing there's good reasons for the current default, and this is just a dumb question, but I thought I'd ask so I can understand the reasons.

    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.

  27. markmsmith commented on Sep 28, 2026

    @markmsmith

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docsarea/wasmno stalebotquestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions