Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Request Interceptor
Threats, Abuse & Incident Response

Request Interceptor

← Back to Glossary
By NHI Mgmt Group Updated November 1, 2026 Domain: Threats, Abuse & Incident Response

A request interceptor is middleware that modifies or replaces an outgoing request before it is sent. In Node.js clients, interceptors are powerful because they can add headers, auth, and routing metadata, but they also become a security boundary when they reconstruct config objects.

What a request interceptor is

A request interceptor sits in the request path before the outbound call is sent. It can inspect, amend, replace, or redirect the request object, which makes it a convenient place for cross-cutting logic such as headers, correlation data, authentication material, and routing decisions.

That power is also what makes it security-sensitive. Once an interceptor is allowed to reconstruct request configuration, it is no longer just a helper layer, it becomes part of the trust boundary around what the client is actually allowed to send.

Why request interceptors are used

Teams use interceptors to avoid repeating the same logic across every call site. Common uses include adding standard headers, attaching tokens, normalising URLs, applying tenant or region metadata, and enforcing client-side policies before a request leaves the process.

In practice, interceptors often become the place where product behaviour and security behaviour meet. That is useful when the logic is deliberate and centrally owned, but it is risky when the interceptor quietly changes the request in ways the caller did not expect.

How they change request behaviour

An interceptor can modify the final request that reaches the network, so the caller does not always control the exact outbound shape of the request. That means downstream services may see different headers, paths, methods, or body content than the original code appeared to send.

Because of that indirection, request interceptors can hide bugs as easily as they can solve them. A small change in order, defaults, or object merging can alter authentication, routing, cache behaviour, or error handling in ways that are difficult to trace during review.

In Node.js clients, the risk is especially sharp when an interceptor rebuilds config objects from partial input. If it copies unsafe fields, drops mandatory protections, or overwrites caller intent, the final request may no longer reflect the intended security posture.

Where request interceptors fit in secure client design

A well-designed interceptor layer is explicit about ownership, mutation scope, and precedence rules. Security-sensitive values should be inserted intentionally, not inferred from ambient state or loosely merged from untrusted objects.

For that reason, request interceptors work best when they are narrow, predictable, and easy to test. They should make the outbound request more consistent, not more surprising, and they should preserve the distinction between application logic and request-authoring authority.

Risk and Threat Considerations

Request interceptors can become a security boundary failure when they reconstruct request config from attacker-influenced or partially trusted data. That can lead to header injection, credential leakage, privilege confusion, or silent request rewriting that changes what the client authenticates to or where it sends data.

Failure mechanism: Unsafe config merging or mutation lets the interceptor override trusted request fields, propagate secrets into the wrong destination, or preserve malicious values that should have been discarded.

Impact: The client may send sensitive data to the wrong endpoint, expose tokens or cookies, or make requests with unintended authority, which can turn a convenience feature into an exploitation path.

Standards & Framework Alignment

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

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementRequest interceptors often handle tokens and other authenticators before outbound use.
AC-6 — Least PrivilegeInterceptors can unintentionally expand what a client may send or access.
SI-10 — Information Input ValidationInterceptor safety depends on rejecting untrusted request fields before they are merged or rewritten.
Recommendation — Restrict interceptor handling of credentials and rotate or revoke any tokens exposed by unsafe request mutation. Constrain interceptor logic to the minimum request fields and destinations needed for the client’s task. Validate outbound request inputs before interceptor code copies or transforms them into the final request.
NIST CSF 2.0PR.AA-05 — Identity Management, Authentication and Access ControlInterceptors commonly insert authentication and routing metadata into outbound requests.
Recommendation — Apply access-control checks to outbound request construction so interceptors only add approved metadata.
OWASP API Security Top 10API5 — Broken Function Level AuthorizationA request interceptor can alter methods or routes and change which functions a client reaches.
Recommendation — Verify that interceptor logic cannot rewrite requests into functions the caller was not authorized to invoke.

Practitioner Guidance

Common misunderstanding: Interceptors are often treated as harmless middleware, but once they can rewrite request state they need explicit security review. The important question is not whether they run before the request, but which fields they are allowed to change and which inputs they trust.

Practitioner takeaway: Treat interceptor mutation as policy code, not plumbing code, and keep the allowed request surface as small and auditable as possible.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

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