Join our Newsletter — 33% off our NHI Course
Home› FAQ› Cyber Security› What do teams get wrong when testing Kong…
Cyber Security

What do teams get wrong when testing Kong custom plugins?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 24, 2026 Domain: Cyber Security

A common mistake is treating unit tests as sufficient and skipping end-to-end coverage, load testing, and cross-version validation. Teams also underuse coverage analysis and fail to test all plugin flows, which leaves edge cases hidden until production. Strong plugin testing should cover functionality, performance, and deployment compatibility, not just a happy path.

Where Kong custom plugin tests usually go shallow

The most common failure is confusing a unit-tested code path with a production-safe plugin. For Kong plugins, the real risk is usually in request/response handling, execution order, configuration parsing, and how the plugin behaves when it is installed alongside other plugins or upgraded across gateway versions. A test suite that only exercises the happy path often misses those integration points.

Teams also tend to over-trust mock-based tests because they are fast and easy to maintain. That approach is useful for isolated logic, but it does not prove the plugin behaves correctly inside Kong’s request lifecycle, against real upstream services, or under concurrency and traffic variation. The gap is not just coverage, it is the difference between verifying code and verifying runtime behaviour.

For plugin authors, the most useful mental model is that a Kong plugin is not finished when functions return the right values. It is finished when it survives full gateway execution, deployment packaging, and the operational conditions that decide whether the plugin can be trusted in a live route.

Why end-to-end and compatibility coverage matter more than a happy-path unit suite

End-to-end tests catch the behaviours that unit tests cannot see, such as phase ordering, header mutation, upstream propagation, schema validation, and interactions with other plugins. They also expose mistakes that only appear when the plugin is loaded through Kong’s real runtime path rather than through a local test harness. That is why the page’s answer emphasises cross-version validation and deployment compatibility.

Version coverage matters because plugins often depend on Kong internals, Lua libraries, or configuration semantics that change subtly between releases. A plugin can appear stable in one version and fail after an upgrade because the runtime contract changed. Compatibility tests should therefore cover the supported Kong versions, plus any packaging or deployment mode that materially changes how the plugin is loaded.

Load testing is equally important when a plugin does work inside the request path, calls external dependencies, or performs expensive transforms. A plugin that passes correctness checks can still create latency spikes, queue build-up, or backpressure under traffic. The operational question is not only whether the plugin works, but whether it remains predictable at the throughput your gateway actually handles.

How to structure testing so edge cases do not hide until production

The strongest approach is to test by behaviour, not just by function. That means covering configuration variants, error branches, retries, malformed inputs, disabled states, and combinations with other enabled plugins. Coverage analysis helps here because it shows whether the suite actually touches each execution branch rather than assuming a few examples are representative.

It also helps to separate three layers of validation: isolated logic tests for deterministic code, integrated gateway tests for lifecycle and interoperability, and performance or soak tests for throughput and failure behaviour. Each layer answers a different question, and none of them substitutes for the others. When teams collapse them into a single unit-test layer, the result is usually blind spots around startup, routing, and runtime state.

A practical standard is to test every flow that changes plugin behaviour, not every line of code in isolation. If a branch affects auth decisions, request mutation, logging, or upstream routing, it should be exercised under realistic conditions and not just through a mocked function call. That is the difference between code coverage and operational confidence.

Risk and Threat Considerations

Weak plugin testing can turn a gateway extension into a production failure amplifier. The main risks are silent bypass of intended controls, broken request handling after upgrades, and performance degradation that only appears under load or mixed plugin stacks. In environments where plugins influence authentication, authorization, or upstream mediation, a test gap can become a real exposure path.

Failure mechanism: Unit-only validation misses runtime interactions, so malformed inputs, plugin ordering conflicts, version drift, and load-induced failures are not caught before deployment. The result is a plugin that looks correct in isolation but behaves unpredictably when embedded in Kong’s live execution path.

Impact: A flawed plugin can deny service, corrupt traffic handling, weaken policy enforcement, or create hidden production risk that is costly to unwind. In security-sensitive gateways, that can affect trust in the control plane as well as the data plane.

Standards & Framework Alignment

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

OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV15 — Secure Coding and ArchitecturePlugin testing must prove runtime behaviour and integration quality.
Recommendation — Verify plugin behaviour across real execution paths and integration points.
NIST SP 800-53 Rev 5SI-2 — Flaw RemediationCross-version testing and defect discovery reduce release risk.
CA-2 — Security AssessmentsEnd-to-end and load tests assess whether the plugin works as intended in context.
Recommendation — Test supported versions before deployment and remediate compatibility defects quickly. Assess the plugin in representative runtime conditions before approving release.
CIS Controls v8CIS-16 — Application Software SecurityCustom plugins are application code that needs testing beyond unit checks.
Recommendation — Validate custom plugin security and behavior with integration and performance tests.

Practitioner Guidance

What to verify: Treat a plugin as release-ready only when you have evidence for correctness, interoperability, and performance. At minimum, verify that the suite exercises all major flows, runs against the supported Kong versions, and includes at least one real deployment-style test that uses the same packaging and runtime path as production.

What practitioners underestimate: The most expensive bugs are often not in the main logic path, they are in plugin ordering, version compatibility, and error handling under traffic. If your tests do not deliberately vary configuration, upstream responses, and traffic volume, you are mostly validating the easy cases.

Practitioner takeaway: For Kong plugins, confidence comes from proving behaviour in the gateway, not from proving code in isolation.

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