Add WASM plugin execution policy (skip_paths, skip_methods, fail_open)#120
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A WASM plugin that failed in its request phase returned a
502for the request, so a failing plugin could take a site down. In production, the Umami analytics plugin also ran on every static asset — buffering a 1.4 MiB JS bundle up to the 1 MiB guest limit on each hit just to ignore it, and turning a collector hiccup into a page-wide502(console.kemeter.cloudassets).This adds three operator-set fields to a plugin declaration in
config.yamlthat control when a plugin runs and how it fails. They are operator-controlled (never overridable per route).skip_paths[]*.js,*.css,/assets/*).*spans any characters including/; case-insensitive; query string ignored.skip_methods[]OPTIONS,HEAD).fail_opentruetruelogs it and lets the request continue to the backend untouched — an observability plugin failing to reach its collector must never turn a page into a502. Setfalsefor a security plugin (WAF / bouncer) that must fail closed (returns502).What changed
PluginConfiggainsskip_paths,skip_methods,fail_open(defaulttrue).PluginPolicy+ a tiny shell-styleglob_match(no regex dep).WasmMiddlewarecarries the policy (shared across per-route derivations viaArc).on_requestskips before any body buffering, and on a guest error honoursfail_open(continue vs502).on_responseapplies the same skip decision.RequestCtxnow carriesmethod/pathso the response phase can make the same skip decision without holding the request.Tests
glob_match, path/method skipping, empty-policy, fail-open — 35 wasm tests green.12-wasm-plugin.sh): a*.jsrequest bypasses the plugin (nox-wasm-pluginheader) while/still carries it. Full suite: 121 passed, 0 failed.cargo fmt --checkclean,clippyclean.console.kemeter.cloudback to 200 on the page and its assets, and the per-request buffering WARN on*.jsis gone.Docs
New "Execution policy" section in the WASM plugins docs, plus a CHANGELOG entry.