Skip to content

GraphQL probes still let the runtime inflate a compressed response before the cap #722

Closed

Description

@nc9

The GraphQL probes behind security/graphql-introspection and security/graphql-get-mutations still fetch with the runtime's own Content-Encoding decoding: sendGraphqlProbe in packages/rules/src/security/graphql-probe.ts calls globalThis.fetch, then readCapped. Bun inflates a compressed body in full as soon as it arrives, before the capped read applies, so a site with active probing on can still answer a probe with a gzip or brotli bomb and cost the audit gigabytes of memory. Every other request the crawl and the audit send to the site moved to fetchUndecoded / readBodyCapped (packages/utils/src/response-body.ts) in #699.

Acceptance Criteria

  • The GraphQL probe request goes out with the runtime's decoding off (fetchUndecoded, or decompress: false plus the shared Accept-Encoding), and its body is read through the shared decoder no further than the probe's existing byte cap (GRAPHQL_RESPONSE_CAPS).
  • A probe whose response is a 1 GiB gzip bomb (and a brotli one) is read to its cap and stays under 256 MiB of RSS, in a test like packages/utils/tests/fetch-undecoded.test.ts.
  • A test with a global fetch spy shows the probe request carries decompress: false, and that an ordinary gzip-encoded GraphQL JSON response still parses to the same probe outcome.
  • security/graphql-introspection and security/graphql-get-mutations findings are unchanged on the existing rule tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugperformancerulessecuritysize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions