Skip to content

[v2] RequestLimitHandlerPlugin does not enforce limits with @orpc/nest #1921

Closed

Description

@Gyeonghun-Park

Environment

  • @orpc/nest: 2.0.0-beta.30 (current main at cc68d421)
  • @orpc/server: 2.0.0-beta.30
  • @nestjs/core: 11.2.1
  • Express: 5.2.1
  • Fastify: 5.12.1
  • Node.js: 26.4.0
  • pnpm: 11.18.0

Reproduction

A failing regression test against the current main branch is available here:

Gyeonghun-Park@36554ed

git clone https://github.com/Gyeonghun-Park/orpc.git
cd orpc
git checkout 36554ed81b4a9214ca8488908c3389fe180f2408
pnpm install
pnpm exec vitest run packages/nest/src/implement.test.ts -t "request limit plugin"

The test configures ORPCModule with RequestLimitHandlerPlugin({ maxBodySize: 10 }), sends a valid JSON body larger than 10 bytes, and exercises both the Express and Fastify adapters.

Describe the bug

When RequestLimitHandlerPlugin is configured through ORPCModule, an oversized request is decoded and handled instead of being rejected. Both the Express and Fastify adapters return 200; I expected a 413 PAYLOAD_TOO_LARGE response.

From tracing the request flow, it appears that ImplementInterceptor captures the initial standardRequest for input decoding. StandardHandler passes the request produced by routing interceptors to resolveProcedure, but the Nest resolver currently ignores that argument. As a result, the request wrapper installed by RequestLimitHandlerPlugin is not used when the input body is decoded.

I have a small fix and regression tests ready and would be happy to submit a PR.

Additional context

This report is specific to v2. The v1 1.x branch uses adapter-specific BodyLimitPlugin implementations and a different Nest handler path.

The proposed change only makes the Nest codec decode input from the request passed to resolveProcedure. It does not change the public API.

Logs

expected 200 to deeply equal 413

Test Files  1 failed (1)
Tests       2 failed | 88 skipped (90)

Activity

  1. pullfrog commented on Aug 22, 2026

    @pullfrog
    Contributor
  2. changed the title [-]RequestLimitHandlerPlugin does not enforce limits with @orpc/nest[/-] [+][v2] RequestLimitHandlerPlugin does not enforce limits with @orpc/nest[/+] on Aug 22, 2026
  3. added
    bug
    on Aug 22, 2026
  4. added a commit that references this issue on Aug 22, 2026
    8a3e0a2
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions