Skip to content

fix: CORS proxy missing timeout, size limits, and encoded path traversal check #118

@rohilsurana

Description

@rohilsurana

Problem

The API proxy (src/server/api/apis-proxy.ts) has three hardening gaps:

  1. Encoded path traversal — only checks path.includes('..') which misses encoded variants like %2e%2e
  2. No fetch timeout — upstream requests can hang indefinitely, tying up server resources
  3. No request body size limit — arbitrarily large payloads accepted, potential DoS vector

These matter because the proxy accepts user input from the "Try it out" API playground in the browser.

Suggested Fix

  • Use path.resolve() with a prefix whitelist check instead of string matching
  • Add AbortSignal.timeout(30_000) to the upstream fetch() call
  • Validate Content-Length header and reject bodies over a reasonable limit (e.g. 1MB)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions