Join our Newsletter — 33% off our NHI Course
Home FAQ Architecture & Implementation How should teams implement custom request filters when…
Architecture & Implementation

How should teams implement custom request filters when they need logic that standard gateway plugins do not provide?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 24, 2026 Domain: Architecture & Implementation

Teams should treat custom filters as a portability and governance decision, not just a coding exercise. The practical approach is to write the filter in a supported language, compile it to WebAssembly, and run it inside a proxy that implements the Proxy-Wasm ABI. This preserves sandboxing, keeps the logic close to traffic, and makes the filter easier to reuse across compatible proxies.

Why custom filters belong in a portability and runtime-safety decision

When standard gateway plugins do not expose the logic you need, the key design question is not just whether the filter works, but where it runs, how it is constrained, and whether another proxy can execute it later. WebAssembly plus the Proxy-Wasm ABI gives teams a common execution model that keeps custom logic close to traffic while preserving a bounded runtime rather than embedding arbitrary native extensions.

That matters because gateway customization often fails at the edges: a plugin may be too opinionated, too proxy-specific, or too tightly coupled to one deployment stack. A wasm-based filter reduces that coupling by turning the custom logic into a portable artifact that can be reused across compatible proxies, provided the host supports the same ABI and runtime expectations.

Implementation should therefore start from the proxy contract. Teams should confirm the host supports the relevant Proxy-Wasm features, then keep the filter narrowly scoped so it does one traffic decision well instead of becoming a general-purpose application component. The goal is to extend the gateway safely, not to turn it into a place where arbitrary business logic accumulates.

What the WebAssembly path changes for security and operations

Running custom logic inside a WebAssembly sandbox changes the risk profile compared with native extensions or out-of-band services. The filter gets isolation from the host process, which helps contain memory-safety failures and limits the blast radius of faulty code. It also keeps the decision in the request path, so enforcement happens at the proxy rather than after the request has already moved deeper into the stack.

The operational tradeoff is that you inherit the constraints of the ABI and runtime. A filter that depends on unsupported syscalls, heavy CPU work, or broad filesystem and network access will be fragile by design. Teams should expect to adapt the implementation to the proxy’s sandbox model, not treat the sandbox as a transparent substitute for normal application execution.

Because the filter is compiled, packaging and release discipline matter more than they do for simple configuration-based plugins. Version drift between the filter and the proxy host can break behavior even when the logic itself is correct. For that reason, teams should treat the filter as a deployable security component with compatibility testing, not as a one-off snippet of code.

When custom filters are the right answer, and when they are not

Custom filters are appropriate when the logic is specific to request handling, must execute before upstream routing or policy evaluation completes, and is stable enough to justify a reusable extension. Typical examples include request shaping, header-based policy decisions, tenant-specific enforcement, or protocol adaptations that standard plugins cannot express cleanly.

They are a poor fit when the logic is effectively application business logic, requires broad state, or depends on external systems so heavily that every request would become a distributed workflow. In those cases, moving the decision into a service or policy layer is usually easier to operate and less coupled to a single gateway implementation.

Teams should also avoid using custom filters as a shortcut around platform governance. If the logic is sensitive, customer-specific, or security-relevant, it needs ownership, code review, testing, rollback planning, and clear compatibility boundaries. The same discipline that applies to other security-critical runtime components applies here too.

Risk and Threat Considerations

Custom request filters introduce risk when teams assume a sandbox removes the need for code quality, compatibility testing, or scope control. A flawed filter can still break routing, weaken policy enforcement, or create availability problems at the proxy layer, and a portable artifact can spread the same defect across many gateways if versioning is not tightly managed.

Failure mechanism: Unsupported runtime calls, excessive resource use, or logic errors can cause filter failure, degraded traffic handling, or inconsistent enforcement between proxy versions and environments.

Impact: The result can be dropped requests, bypassed controls, hard-to-diagnose outages, or repeated rollout of the same faulty behavior across multiple gateways.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS and NIST SP 800-53 Rev 5 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP ASVSV15 — Secure Coding and ArchitectureCustom filter logic must be designed and verified as bounded runtime code.
Recommendation — Keep filter logic narrow and verify it against the proxy's execution constraints.
NIST SP 800-53 Rev 5SC-39 — Process IsolationWebAssembly sandboxing is a process-isolation control concern for proxy-executed code.
CM-2 — Baseline ConfigurationProxy-Wasm deployments need controlled host/runtime baselines for compatibility.
Recommendation — Use isolated execution to confine filter failures and limit blast radius. Standardize proxy and runtime baselines before shipping custom filters.
ISO/IEC 27001:2022A.8.9 — Configuration managementFilter portability depends on managed runtime and deployment configuration.
Recommendation — Control proxy runtime settings and approved filter versions.

Practitioner Guidance

What to verify: Confirm the host actually implements the Proxy-Wasm ABI features your filter depends on, and test the compiled artifact against the exact proxy versions you plan to run. A filter that is portable in theory can still fail if the host’s capability set is narrower than the implementation assumes.

Decision rule: If the logic must be reusable, request-path local, and bounded by a sandbox, wasm is usually the right extension model; if it needs broad platform access or complex orchestration, move it out of the proxy instead of stretching the filter design.

Practitioner takeaway: Treat custom filters as governed runtime extensions, not convenience code, because the real design constraint is safe portability under the proxy’s execution limits.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 24, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org