# GHSA-58R7-2F58-X3F6: Method-level guards ignored on routes synthesized by router-contract @Implement in @orpc/nest

- Database: GitHub
- Severity: CVSS 8.2 (High)
- Published: 2026-08-04
- Modified: 2026-08-04

## Affected versions

- @orpc/nest (npm): fixed in 1.14.14

## Description

### Summary

Method-level `@UseGuards` (as well as `@UsePipes`, `@UseFilters`, and `@SetMetadata`) applied to a controller method decorated with `@Implement` for a **contract router** were silently ignored. Routes that appeared protected by a guard were publicly reachable.

This does **not** happen when `@Implement` is used with a single contract procedure. Class-level enhancers and global guards were also unaffected.

### Details

NestJS stores enhancer metadata on the decorated function object. When `@Implement` receives a contract router, it synthesizes a fresh route function for each procedure in the router and registers those as the actual route handlers. Nest then looks up guard metadata on the synthesized functions, not on the original method, so the guards never run. This happens regardless of decorator order.

Vulnerable pattern (contract router, guard silently ignored):

```ts
@Controller()
export class PlanetController {
  @UseGuards(AuthGuard) // never executed before v1.14.14
  @Implement(planetContract) // a contract router with multiple procedures
  planets() {
    return {
      list: implement(planetContract.list).handler(listPlanets),
      create: implement(planetContract.create).handler(createPlanet),
    }
  }
}
```

Not affected (single contract procedure, guard runs as expected):

```ts
@Controller()
export class PlanetController {
  @UseGuards(AuthGuard) // works correctly in all versions
  @Implement(planetContract.create) // a single procedure
  create() {
    return implement(planetContract.create).handler(createPlanet)
  }
}
```

### Impact

Any authorization or authentication enforced through method-level guards on a router-contract `@Implement` handler was not applied. Unauthenticated requests to those routes succeeded instead of being rejected.

### Patches

Fixed in [v1.14.14](https://github.com/middleapi/orpc/releases/tag/v1.14.14) (https://github.com/middleapi/orpc/pull/1775): each synthesized route function now inherits from the original method via its prototype chain, so Nest resolves guards, pipes, filters, and metadata correctly in either decorator order. Upgrade to `@orpc/nest@1.14.14` or later.

### Workarounds

If upgrading is not possible, apply guards at the class level (`@UseGuards` on the controller) or register them globally, or use `@Implement` with individual procedures instead of a router. All of these were unaffected.

## References

- https://github.com/middleapi/orpc/security/advisories/GHSA-58r7-2f58-x3f6

Page: https://cve.now/GHSA-58R7-2F58-X3F6

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
