Skip to content

fix(routes): fail closed when a response does not match its schema #429

Closed

Description

@Bccorb

Why

Response schemas are how the API keeps responses minimal. When a response fails its own schema, defineRoute logs the mismatch and sends the raw payload anyway (src/lib/defineRoute.ts, around lines 351 to 362). Any controller that returns more than it should then leaks it, which is the case the validation exists to catch.

What

  • On a response schema mismatch, send a generic 500 (InternalErrorSchema) instead of the raw payload, and log the route and the failing paths
  • A test that a mismatching response is not sent
  • Generated contract tests still pass, so no current route trips this

Done when

No response that fails its schema reaches a client.

Activity

  1. added this to the v0.19 milestone on Oct 17, 2026
  2. added theissue type on Oct 17, 2026
  3. added
    P1Security work outside the FIDO2 track
    secureServes the most-secure promise
    v0.19Targets the v0.19 release
    on Oct 17, 2026
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

    P1Security work outside the FIDO2 tracksecureServes the most-secure promisev0.19Targets the v0.19 release

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions